short_curdir() { if [ "$PWD" = / ]; then echo / return fi if [ "$PWD" = "$HOME" ]; then echo "~" return fi local _short_curdir _short_curdir="${PWD##*/}" # cut all directories, get base name if [ "${#_short_curdir}" -gt 15 ]; then _short_curdir="${_short_curdir::15}..." # cut long string fi echo "${_short_curdir}" }