summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbalou <balou@tilde.institute>2022-09-20 13:07:05 +0000
committerbalou <balou@tilde.institute>2022-09-20 13:07:05 +0000
commitd73827198e58db9cb66d86eeac481db5953d7796 (patch)
treeffa8b985dc0df9d6db0f0dbb4d00a8cc3e1c4d90
parentfe30283cd6dfcac70df90e3939693d7ad37d1751 (diff)
downloadportable-prompt-d73827198e58db9cb66d86eeac481db5953d7796.tar.gz
move function to calculate current dir around
-rw-r--r--portable-prompt.sh22
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