Simple shell script to cd into your project every damn time

Well guys,

Lots of my projects are source-controlled with git and while I’ve got a git-compatible gui application installed, many a time I still find myself literally ‘cd’-ing into the working directory instead.

That’s why I just did myself a favour and have this shell script placed right in my home folder:


[ ! -z “$1” ] && echo “Going to $1” || echo “Please specify a destination”

case $1 in

                cd /path/to/destination/1

                cd /path/to/destination/2


Assuming that script is saved as ‘’ in my home directory (with proper execution permission applied), every time the machine is started up, I’ll just have to type, for example:

. destination1

Please notice the little dot character (.) before the script name because that’s what makes your current interactive shell window actually ‘cd’ into the desired directory.

Kinda wonder why i’ve never done something like this before. My keyboards should last much longer from now on thanks to this..


Updated on Apr 7th 2014

A cousin of mine was saying he’d rather export the values into global variables, which is, of course, another approach, or in that sense, one can utilise alias for pretty much the same result, so yeah, this is mainly just my appetite as I simply don’t want my globals or bash profiles cluttered up with values I might totally have no idea about in 6 months’ time; hence, if I could just store everything in a bit of a “conspicuous” little script file in the home dir, my OCD on organisation might finally leave me alone with my work.

One thought on “Simple shell script to cd into your project every damn time

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s