I'm trying to come up with a shortcut so that I can quickly switch directories. For example, I have a ~/company/bundles, ~/company/demos and ~/company/apps. I want to be able to type
demo barcode
# same as as cd ~/company/demos/barcode-demo
bu barcode
# same as cd ~/company/bundles/barcode-bundle
app kpa
# same as cd ~/company/apps/kpa
My .bashrc file has this now:
alias bu="my-cd company/bundles $1"
alias demo="my-cd company/demos ${1}"
alias app="my-cd company/apps ${1}"
function my-cd() {
cd "/home/tac/$1/$2"
}
This partially works (app), "app kpa" will get me to the kpa directory. And "bu barcode-bundle" works, of course.
But if I want to append the suffix, it stops working, and ignores the $1 part.
alias bu="my-cd company/bundles $1-bundle"
alias demo="my-cd company/demos ${1}-demo"
I suspect I'm not properly contacting the string of the second argument.