allow script to work from any installation directory

line 1 to 11 makes the script work if installed anywhere, not just in .bash