Zsh 别名无法像 bash 中那样工作
我在 .bashrc
中使用此别名,但在使用 .zshrc
的 zsh
中似乎不起作用。我使用的其他别名工作正常,因此我知道 .zshrc
正在获取其他别名。
alias rubydev3="cd ~/code/ruby/rails/rails3projects/"
这是错误消息:
cd:cd:10: no such file or directory: /home/jryan/code/ruby/rails/rails3tutorial/
我不知道 cd:cd:10
是否意味着任何应该作为线索的东西,但我刚刚开始使用 zsh
所以我我不知所措。如果该命令应该像我在这篇文章中那样工作,我确信它可能与另一个配置文件冲突或类似的事情有关。
I use this alias in my .bashrc
but doesn't seem to work in zsh
using .zshrc
. Other aliases I use are working fine so I know the .zshrc
is sourcing other aliases.
alias rubydev3="cd ~/code/ruby/rails/rails3projects/"
This is the error message:
cd:cd:10: no such file or directory: /home/jryan/code/ruby/rails/rails3tutorial/
I don't know if the cd:cd:10
means anything that should be a clue, but I am just starting to use zsh
so I'm at a loss. If the command should work as I have it in this post that I'm sure it probably has something to do with another config file conflicting or something like that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试定义一个函数而不是别名:
Try defining a function instead of an alias:
错误信息是在尝试使用别名时还是在处理
~/.zshrc
时发出的?我注意到错误消息的目录与别名不同。尝试这个命令:它将向您展示如何定义“rubydev3”。
它有可能被重新定义。
此外,
cd
可能已使用别名,这会产生干扰。要解决这个问题,请使用以下命令:Is the error message issued when you try to use the alias or during the processing of
~/.zshrc
? I notice that the error message has a different directory than the alias. Try this command:It will show you how "rubydev3" is defined.
It's possible that it's getting redefined.
Also, it's possible that
cd
has been aliased and that's interfering. To fix that, use this:偶尔 - 你在使用 rvm 吗?这会为 cd 添加功能,请尝试将其关闭。
On the off chance - Are you using rvm? This adds functionality to cd, try turning it off.