Find Out Script Location in Bash Mar 3rd, 2015 This is the most portable method: DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"