Bring prompt_pwd under Darwin to parity with non-Darwin

The echo command to print the last path segment got a couplel of fixes,
but these fixes were only applied to the non-Darwin version. Copy these
fixes over to the Darwin version. Notably, this makes `/` stop
displaying as `//`.
This commit is contained in:
Kevin Ballard 2012-06-22 18:35:44 -07:00 committed by ridiculousfish
parent 529d410bec
commit 1a93cbba1e

View file

@ -3,7 +3,7 @@ if test (uname) = Darwin
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
if test "$PWD" != "$HOME"
printf "%s" (echo $PWD|sed -e 's|^/private\(/.\{1,\}\)|\1|' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-'
echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p'
else
echo '~'
end
@ -20,4 +20,3 @@ else
end
end
end