mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
This patch fixes a problem where prompt_pwd was printing the full path twice under OS X and probably BSDs. (Which, needless to say, made for very long prompts) The problem was that (Free?)BSD sed and GNU sed handle ? differently. For BSD sed, ? is not special unless the -E flag is specified. The {0,1} syntax should work the same way in both.
darcs-hash:20080122180340-5b666-21f1cdb835cbfa458a0f3d7344370837db962388.gz
This commit is contained in:
parent
c08c313c0a
commit
79784d3e18
1 changed files with 4 additions and 4 deletions
|
@ -2,8 +2,8 @@
|
|||
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||' -e "s|^$HOME|~|" -e 's-/\(\.\?[^/]\)\([^/]*\)-/\1-g')
|
||||
echo $PWD|sed -e 's-.*/\.\?[^/]\([^/]*$\)-\1-'
|
||||
printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
|
||||
echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-'
|
||||
else
|
||||
echo '~'
|
||||
end
|
||||
|
@ -15,8 +15,8 @@ else
|
|||
echo '~'
|
||||
|
||||
case '*'
|
||||
printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\?[^/]\)\([^/]*\)-/\1-g')
|
||||
echo $PWD|sed -n -e 's-.*/\.\?.\([^/]*\)-\1-p'
|
||||
printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
|
||||
echo $PWD|sed -n -e 's-.*/\.\{0,1}.\([^/]*\)-\1-p'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue