Shell 如何配置命令始终与某些参数一起使用?
我想知道如何配置您的环境以在每次使用时执行带有特定参数的命令。 所以,如果我有一个名为:
规格
知道我在哪里配置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否记得编辑后执行
.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.