commit: 2f6ff29dbafc1450c340f57f8d89af1fa12aeb11
parent 301aa198c054ed699ed382967b9eaddbcaa56619
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 21 Jun 2024 22:07:59 +0200
.common.sh: Don't export PS1/…/PS4 variables
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/.common.sh b/.common.sh
@@ -84,17 +84,19 @@ jobs_pp() {
fi
}
+# Note: PS1/…/PS4 variables are shell specific and therefore shouldn't be exported
+PS4='[32m$ [0m'
case $SHELL in
*ksh*)
# hack derived from ksh88(1), works in mksh, doesn't works in bash
- export PS1='$(jobs_pp)[47;30m$?[37;100m[100;30m$(date +w%wT%T)[40;90m[40;32m${USER}[${host_ansi}m@$(hostname)[30;46m$(get_working_directory)$(get_git_branch)[0m '
+ PS1='$(jobs_pp)[47;30m$?[37;100m[100;30m$(date +w%wT%T)[40;90m[40;32m${USER}[${host_ansi}m@$(hostname)[30;46m$(get_working_directory)$(get_git_branch)[0m '
;;
*bash*)
- export PS1='\[\e[47;30m\]$(jobs_pp)$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] '
+ PS1='\[\e[47;30m\]$(jobs_pp)$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] '
;;
*)
# Don't even try escape codes, and so no powerline-style
- export PS1='$? $(date +w%wT%T) $USER@${HOSTNAME:=$(hostname)} $(get_working_directory) > '
+ PS1='$? $(date +w%wT%T) $USER@${HOSTNAME:=$(hostname)} $(get_working_directory) > '
;;
esac