开发者

Zsh alias not working as in bash

开发者 https://www.devze.com 2023-01-10 19:21 出处:网络
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.

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 ruby开发者_如何学Cdev3="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.


Try defining a function instead of an alias:

function rubydev3 {
    builtin cd ~/code/ruby/rails/rails3projects/
}


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:

type -a rubydev3

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:

alias rubydev3="builtin cd ~/code/ruby/rails/rails3projects/"


On the off chance - Are you using rvm? This adds functionality to cd, try turning it off.

export rvm_project_rvmrc=0
0

精彩评论

暂无评论...
验证码 换一张
取 消