if [[ ! -d ~/bin ]] then mkdir ~/bin fi
parentDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "$parentDir"
Note: Also the actual file of a symbolic link
filePath="$(readlink $filePath)" filePath="$(readlink ~/dir)"