Joe Ryan
Joe Ryan

Reputation: 813

Zsh alias not working as in bash

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.

Upvotes: 3

Views: 2813

Answers (3)

AnimiVulpis
AnimiVulpis

Reputation: 2726

Try defining a function instead of an alias:

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

Upvotes: 1

Kris
Kris

Reputation: 19958

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

export rvm_project_rvmrc=0

Upvotes: 0

Dennis Williamson
Dennis Williamson

Reputation: 360685

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/"

Upvotes: 0

Related Questions