SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
How to Set the Default Terminal on Mac OS X

I was testing out a bash script on my Mac and the script had some code to switch the shell from /bin/zsh to /bin/bash so that I would have similar shell to the servers the code would run on. There was also code to switch it back to /bin/zsh but I think with the script … Continued