Shell 如何配置命令始终与某些参数一起使用?

发布于 2024-09-02 04:52:47 字数 327 浏览 4 评论 0原文

我想知道如何配置您的环境以在每次使用时执行带有特定参数的命令。 所以,如果我有一个名为:

规格

知道我在哪里配置 bash 以始终使用:

spec -c --format 嵌套

而不只是“spec”

我试图将其作为别名放在我的 .bashrc 文件上,例如:

别名spec='spec -c --format Pretty'

但不起作用。 有什么建议吗?

I want to know how to configure your environment to execute some command with specific params everytime you use it.
So, if I have a command named:

spec

I want to know where I configure my bash to always use:

spec -c --format nested

instead of just 'spec'

I tried to put this like an alias on my .bashrc file, like:

alias spec='spec -c --format pretty'

but didn't work.
Any tip?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2024-09-09 04:52:47

您是否记得编辑后执行 .bashrc

<代码>。 ~/.bashrc 就可以了。

另外,您的两个命令不匹配。你在其中一个“嵌套”,在另一个中“漂亮”。

Did you remember to execute your .bashrc after editing it?

. ~/.bashrc will do it.

Also, your two commands don't match. You have "nested" in one and "pretty" in the other.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文