[bash] fix prompt for nested shells
We need to determine and correct the level before we build the prompt.
This commit is contained in:
parent
98b7c1532d
commit
ac3985f5b4
1 changed files with 3 additions and 2 deletions
5
bashrc
5
bashrc
|
@ -157,12 +157,13 @@ bashrc_customize_terminal_colors() {
|
|||
}
|
||||
|
||||
bashrc_customize_prompt() {
|
||||
local level=$SHLVL color="$cyan" prompt=$(printf '\$%.0s' $(seq 1 $level))
|
||||
|
||||
local level=$SHLVL
|
||||
if [[ -n "$TMUX" ]]; then
|
||||
level=$(($SHLVL - 2))
|
||||
fi
|
||||
|
||||
local color="$cyan"
|
||||
local prompt=$(printf '\$%.0s' $(seq 1 $level))
|
||||
if [ $EUID -eq 0 ]; then
|
||||
# root user
|
||||
prompt=$(printf '#%.0s' $(seq 1 $level))
|
||||
|
|
Loading…
Add table
Reference in a new issue