.profile: Change $ color depending on current shell
This commit is contained in:
parent
09227227f5
commit
e12729f5ab
20
.profile
20
.profile
@ -85,6 +85,8 @@ _ps1() {
|
|||||||
fg_blue="\e[34m"
|
fg_blue="\e[34m"
|
||||||
fg_red="\e[31m"
|
fg_red="\e[31m"
|
||||||
fg_green="\e[32m"
|
fg_green="\e[32m"
|
||||||
|
fg_yellow="\e[33m"
|
||||||
|
fg_grey="\e[37m"
|
||||||
fg_bold="\e[1m"
|
fg_bold="\e[1m"
|
||||||
|
|
||||||
hostname_prefix="${fg_blue}"
|
hostname_prefix="${fg_blue}"
|
||||||
@ -93,6 +95,22 @@ _ps1() {
|
|||||||
# Also add the machine's hostname
|
# Also add the machine's hostname
|
||||||
hostname_prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:"
|
hostname_prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:"
|
||||||
fi
|
fi
|
||||||
|
# Change $ color depending on shell
|
||||||
|
cashcolor="${fg_green}"
|
||||||
|
case $0 in
|
||||||
|
bash)
|
||||||
|
cashcolor="${fg_blue}"
|
||||||
|
;;
|
||||||
|
ksh)
|
||||||
|
cashcolor="${fg_yellow}"
|
||||||
|
;;
|
||||||
|
sh)
|
||||||
|
cashcolor="${fg_grey}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cashcolor="${fg_green}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
# Show the tilde instead of $HOME
|
# Show the tilde instead of $HOME
|
||||||
cpwd="${PWD/#$HOME/\~}"
|
cpwd="${PWD/#$HOME/\~}"
|
||||||
# Alert us if the last command failed
|
# Alert us if the last command failed
|
||||||
@ -100,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}${fg_green}\$${r} "
|
printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${cashcolor}\$${r} "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! [ "$ZSH_NAME" ]; then
|
if ! [ "$ZSH_NAME" ]; then
|
||||||
|
Reference in New Issue
Block a user