2006-02-12 13:14:21 +00:00
|
|
|
|
|
|
|
if test (uname) = Darwin
|
2007-01-16 01:29:18 +00:00
|
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
2006-02-12 13:14:21 +00:00
|
|
|
if test "$PWD" != "$HOME"
|
2008-01-16 22:36:21 +00:00
|
|
|
printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\?[^/]\)\([^/]*\)-/\1-g')
|
|
|
|
echo $PWD|sed -e 's-.*/\.\?[^/]\([^/]*$\)-\1-'
|
2006-02-12 13:14:21 +00:00
|
|
|
else
|
|
|
|
echo '~'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
2007-01-16 01:29:18 +00:00
|
|
|
function prompt_pwd --description "Print the current working directory, shortend to fit the prompt"
|
2007-09-08 19:17:17 +00:00
|
|
|
switch "$PWD"
|
|
|
|
case "$HOME"
|
2006-02-12 13:14:21 +00:00
|
|
|
echo '~'
|
2007-09-08 19:17:17 +00:00
|
|
|
|
|
|
|
case '*'
|
2008-01-16 22:36:21 +00:00
|
|
|
printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\?[^/]\)\([^/]*\)-/\1-g')
|
|
|
|
echo $PWD|sed -n -e 's-.*/\.\?.\([^/]*\)-\1-p'
|
2006-02-12 13:14:21 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|