I have .bash_aliases
with:
alias c1='cd /home/me/code/php'
alias c2='cd /home/me/code/jquery'
alias c3='cd /home/me/code/ruby'
alias c4='cd /home/me/code/c'
How can I DRY this up and loosen the coupling to that entire directory structure?
I have tried:
alias code_base='/home/me/code/'
alias c1='cd code_base/php'
alias c2='cd code_base/jquery'
alias c3='cd code_base/ruby'
alias c4='cd code_base/c'
but I get the error 'is a directory' when I try and use c1
through c4
.
I also tried:
alias c1='cd `code_base`/php'
but that didn't work; it gave me:
bash: cd: /php: No such file or directory
I tried alias c1='cd '+
work+'/php'
, but that gave me the directory error too.