Make a bash-script change directory to where it is located!

In case you have files that are located in the same directory as the script that are read by the script, and you are to lazy to make it a configuration variable 🙂

SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH

You may also like...