Because I’m lazy, I often set up Bash aliases to project directories I’m working on a lot. It’s highly annoying to manually type out the path to the folder every time I open a new terminal (wow just typing that made me feel like a potato). What I typically do is:
`echo "alias foo=\"cd $PWD\"" >> ~/.bash_aliases`
And that adds an alias named
foo the current working directory. Of course, first you have to
source ~/.bash_aliases to make the alias work in the current session.
But that seems clunky. So I wrote a Ruby gem to do it for me. It’s live at RubyGems.
Usage is simple: navigate to project directory you want an alias to, type
aliasify foo, and the deed is done. Check out the GitHub repo for more info.
Sidenote: you really should be using a file named
.bash_aliases for your aliases instead of adding them to
.bash_profile or whatever. Move your aliases from there to a new file called
~/.bash_aliases, and add to the formerly mentioned script(s) the following lines:
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
It’s just better.