shorten path: properly escape \ (bash) or % (zsh)

This commit is contained in:
Olivier Mengué 2014-01-03 09:32:08 +01:00
parent 5b52a1d4d0
commit 83b0ea8ea8

View File

@ -575,8 +575,12 @@ _lp_shorten_path()
ret="${ret}${mask}${p:${#p} - ${len_left}}${base}"
fi
fi
echo "${ret}"
# Escape special chars
if $_LP_SHELL_bash; then
LP_PWD="${ret/\\/\\\\}"
else # zsh
LP_PWD="${ret/%/%%}"
fi
}
# In bash shell, PROMPT_DIRTRIM is the number of directory to keep at the end