[bash] make nested shells visible on prompt
The $ or # now gets repeated as many times as levels of shell nesting we have.
This commit is contained in:
parent
807d172521
commit
e449444252
1 changed files with 15 additions and 6 deletions
21
bashrc
21
bashrc
|
@ -158,14 +158,23 @@ do_solarize_shell() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Customize the prompt
|
# Customize the prompt
|
||||||
if [ $(id -u) -eq 0 ]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
__c="1;31" # orange user name for root
|
LVL=$(($SHLVL - 2))
|
||||||
elif [ -n "$SSH_CLIENT" ]; then
|
|
||||||
__c="0;33" # yellow user name when connected via SSH
|
|
||||||
else
|
else
|
||||||
__c="0;36" # default user name color is cyan
|
LVL=$SHLVL
|
||||||
fi
|
fi
|
||||||
export PS1="[\[\033[${__c}m\]\u@\h \[\033[0;34m\]\w\[\033[0m\]]\n\$ "
|
if [ $EUID -eq 0 ]; then
|
||||||
|
PROMPT=$(printf '#%.0s' $(seq 1 $LVL))
|
||||||
|
COLOR="1;31" # orange user name for root
|
||||||
|
else
|
||||||
|
PROMPT=$(printf '\$%.0s' $(seq 1 $LVL))
|
||||||
|
if [ -n "$SSH_CLIENT" ]; then
|
||||||
|
COLOR="0;33" # yellow user name when connected via SSH
|
||||||
|
else
|
||||||
|
COLOR="0;36" # default user name color is cyan
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
export PS1="[\[\033[${COLOR}m\]\u@\h \[\033[0;34m\]\w\[\033[0m\]]\n$PROMPT "
|
||||||
export PS2=". "
|
export PS2=". "
|
||||||
|
|
||||||
# Customize colors for `ls` command
|
# Customize colors for `ls` command
|
||||||
|
|
Loading…
Add table
Reference in a new issue