From e12729f5abb4fd99c0f19a61b419e8f5284586e1 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 3 Oct 2018 22:50:23 -0500 Subject: [PATCH] .profile: Change $ color depending on current shell --- .profile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.profile b/.profile index 1f3e62f6..877c0565 100755 --- a/.profile +++ b/.profile @@ -85,6 +85,8 @@ _ps1() { fg_blue="\e[34m" fg_red="\e[31m" fg_green="\e[32m" + fg_yellow="\e[33m" + fg_grey="\e[37m" fg_bold="\e[1m" hostname_prefix="${fg_blue}" @@ -93,6 +95,22 @@ _ps1() { # Also add the machine's hostname hostname_prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:" 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 cpwd="${PWD/#$HOME/\~}" # Alert us if the last command failed @@ -100,7 +118,7 @@ _ps1() { if ! [ "$exitcode" = "0" ]; then fail="${fg_bold}${fg_red}?" fi - printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} " + printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${cashcolor}\$${r} " } if ! [ "$ZSH_NAME" ]; then