.prefix: Change the way alternate shells are presented
Now they have a different bracket (parenthesis) and a different-colored PWD, even in SSH sessions
This commit is contained in:
parent
ca5cc3de19
commit
51975d3326
18
.profile
18
.profile
@ -85,32 +85,30 @@ _ps1() {
|
|||||||
exitcode="$?"
|
exitcode="$?"
|
||||||
r="\e[0m"
|
r="\e[0m"
|
||||||
fg_blue="\e[34m"
|
fg_blue="\e[34m"
|
||||||
|
fg_cyan="\e[36m"
|
||||||
fg_red="\e[31m"
|
fg_red="\e[31m"
|
||||||
fg_green="\e[32m"
|
fg_green="\e[32m"
|
||||||
fg_yellow="\e[33m"
|
fg_yellow="\e[33m"
|
||||||
fg_grey="\e[37m"
|
fg_grey="\e[37m"
|
||||||
fg_bold="\e[1m"
|
fg_bold="\e[1m"
|
||||||
|
|
||||||
# Change PWD color in SSH sessions
|
# Add hostname prefix in SSH sessions
|
||||||
hostname_prefix="${fg_blue}"
|
|
||||||
if [ "$SSH_CLIENT" ]; then
|
if [ "$SSH_CLIENT" ]; then
|
||||||
# Also add the machine's hostname
|
# Also add the machine's hostname
|
||||||
hostname_prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:"
|
prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:"
|
||||||
fi
|
fi
|
||||||
# Change $ color depending on shell
|
# Change PWD color depending on the shell
|
||||||
cashcolor="${fg_green}"
|
|
||||||
case $0 in
|
case $0 in
|
||||||
bash)
|
bash)
|
||||||
cashcolor="${fg_blue}"
|
prefix="${prefix}${fg_yellow}"
|
||||||
;;
|
;;
|
||||||
ksh)
|
ksh)
|
||||||
cashcolor="${fg_yellow}"
|
prefix="${prefix}${fg_green}"
|
||||||
;;
|
;;
|
||||||
sh)
|
sh)
|
||||||
cashcolor="${fg_grey}"
|
prefix="${prefix}${fg_grey}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cashcolor="${fg_green}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# Show the tilde instead of $HOME
|
# Show the tilde instead of $HOME
|
||||||
@ -120,7 +118,7 @@ _ps1() {
|
|||||||
if ! [ "$exitcode" = "0" ]; then
|
if ! [ "$exitcode" = "0" ]; then
|
||||||
fail="${fg_bold}${fg_red}?"
|
fail="${fg_bold}${fg_red}?"
|
||||||
fi
|
fi
|
||||||
printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${cashcolor}\$${r} "
|
printf "(${prefix}${cpwd}${r})${fail}${r}${fg_green}\$${r} "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! [ "$ZSH_NAME" ]; then
|
if ! [ "$ZSH_NAME" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user