mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 17:31:14 -03:00
Fix prompt_cwd on darwin systems when $PWD is "/private"
When $PWD is "/private", the prompt was printing "rivate". Skip the "/private" stripping if there's nothing after it. Prevent "/private" from being stripped anywhere but the beginning of the PWD. Fixes #173
This commit is contained in:
committed by
ridiculousfish
parent
4d1c0eaa52
commit
529d410bec
@@ -2,7 +2,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||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g')
|
||||
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-'
|
||||
else
|
||||
echo '~'
|
||||
|
||||
Reference in New Issue
Block a user