]> git.wh0rd.org - home.git/blobdiff - .profile.d/PS1.sh
PS1: shorten slightly & add PS0 recovery
[home.git] / .profile.d / PS1.sh
index 731133db9f18fbdaeacd88e7c230f29e13797903..5f9b765baa37d6c4942c74e9a879f60c45eedf60 100644 (file)
@@ -1 +1,16 @@
-PS1='\[\e[0;33m\]\u\[\e[30;1m\]@\[\e[31;1m\]\h'$([ -e /etc/ps1_append ] && cat /etc/ps1_append)'\[\e[30;1m\] \j:$? \[\e[34;1m\]\W \$\[\e[0m\] '
+if [ "${TERM}" != "dumb" ] ; then
+       # Set the terminal's window title.
+       PS1='\[\e(B\017\e]0;\u@\h \w\007\]'
+       if [ -n "${SDK_VERSION}" ] ; then
+               PS1+="(sdk ${SDK_BOARD} ${SDK_VERSION}) "
+       fi
+       # The cat here affects the exit code after this assignment.
+       PS1+='\[\e[33m\]\u\[\e[30;1m\]@\[\e[31;1m\]\h'\
+$(cat /etc/ps1_append 2>/dev/null || :)\
+"${TARGET_PRODUCT+ {${TARGET_PRODUCT}\}}"\
+'\[\e[30;1m\] \j:$? \[\e[34;1m\]\W \$\[\e[m\] '
+
+       # PS0 is displayed after the current prompt but before the command.
+       # Reset any latent colors.
+       PS0='\e[m'
+fi