Lately I’ve been finding myself working predominantly in and around a particular directory for a day or two, and then moving somewhere else. I like a lot of organization in my file system, but the downside to that is a lot of times, the project I’m working on is buried many levels deep in my folder structure, and I start to spend a lot of time typing out change directory commands (okay, not a lot, but definitely enough to be annoying!). Today I wrote a script to do something about it. Now all I have to do is type set-current from any directory, and a link to the current directory titled current will be placed in my home folder. Here’s the script:
#!/bin/sh # set-current if [ -e $HOME/current ]; then echo "Overwrite $HOME/current? (y or n)" read answer if [ $answer = y ]; then rm $HOME/current ln -s $PWD $HOME/current fi else ln -s $PWD $HOME/current fi
Place set-current in /usr/local/bin, or any other place you wish in your PATH and that’s it.