diff options
author | balou <balou@tilde.institute> | 2022-09-20 13:07:05 +0000 |
---|---|---|
committer | balou <balou@tilde.institute> | 2022-09-20 13:07:05 +0000 |
commit | d73827198e58db9cb66d86eeac481db5953d7796 (patch) | |
tree | ffa8b985dc0df9d6db0f0dbb4d00a8cc3e1c4d90 | |
parent | fe30283cd6dfcac70df90e3939693d7ad37d1751 (diff) | |
download | portable-prompt-d73827198e58db9cb66d86eeac481db5953d7796.tar.gz |
move function to calculate current dir around
-rw-r--r-- | portable-prompt.sh | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/portable-prompt.sh b/portable-prompt.sh index 1ea948b..926e447 100644 --- a/portable-prompt.sh +++ b/portable-prompt.sh @@ -39,6 +39,17 @@ prompt_helper(){ RET="[$RET]" fi + local pwd + case $PWD in + $HOME*) + pwd="~${PWD#"$HOME"}" + ;; + *) + pwd=$PWD + ;; + esac + PWEXT=$pwd + if [ "$CHECKWINSIZE" ]; then set -- $(stty size) export LINES=$1 @@ -85,17 +96,6 @@ pretty_title(){ fi local host=${DISPLAYHOST-$HOSTNAME} local tty="(${COLUMNS}x${LINES} ${TTY})" - local pwd - case $PWD in - $HOME*) - pwd="~${PWD#"$HOME"}" - ;; - *) - pwd=$PWD - ;; - esac - PWEXT=$pwd - #local pwd=${PWD/$HOME/~} if [ -n "$extra" ]; then |