From 51975d33265accca116bf3d5f1a51dcbeda536d5 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 7 Oct 2018 00:15:04 -0500 Subject: [PATCH] .prefix: Change the way alternate shells are presented Now they have a different bracket (parenthesis) and a different-colored PWD, even in SSH sessions --- .profile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.profile b/.profile index e01a9d9f..75892bd6 100755 --- a/.profile +++ b/.profile @@ -85,32 +85,30 @@ _ps1() { exitcode="$?" r="\e[0m" fg_blue="\e[34m" + fg_cyan="\e[36m" fg_red="\e[31m" fg_green="\e[32m" fg_yellow="\e[33m" fg_grey="\e[37m" fg_bold="\e[1m" - # Change PWD color in SSH sessions - hostname_prefix="${fg_blue}" + # Add hostname prefix in SSH sessions if [ "$SSH_CLIENT" ]; then # 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 - # Change $ color depending on shell - cashcolor="${fg_green}" + # Change PWD color depending on the shell case $0 in bash) - cashcolor="${fg_blue}" + prefix="${prefix}${fg_yellow}" ;; ksh) - cashcolor="${fg_yellow}" + prefix="${prefix}${fg_green}" ;; sh) - cashcolor="${fg_grey}" + prefix="${prefix}${fg_grey}" ;; *) - cashcolor="${fg_green}" ;; esac # Show the tilde instead of $HOME @@ -120,7 +118,7 @@ _ps1() { if ! [ "$exitcode" = "0" ]; then fail="${fg_bold}${fg_red}?" fi - printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${cashcolor}\$${r} " + printf "(${prefix}${cpwd}${r})${fail}${r}${fg_green}\$${r} " } if ! [ "$ZSH_NAME" ]; then