bash_aliases: prompt command: set directory to ~ if $PWD == $HOME

This commit is contained in:
Josh Holtrop 2015-02-10 09:45:55 -05:00
parent b3fed0516b
commit c1b3d2b473

View File

@ -54,7 +54,9 @@ case "$TERM" in
function prompt_command_change_terminal_title()
{
local dirname=""
if [[ "${PWD}" =~ .*/(.*) ]]; then
if [[ "${PWD}" == "${HOME}" ]]; then
dirname="~"
elif [[ "${PWD}" =~ .*/(.*) ]]; then
dirname="${BASH_REMATCH[1]}"
fi
echo -ne "\033]0;"$dirname" [${USER}@${HOSTNAME}: ${PWD}]\007"