From ac3985f5b4fc81a7ef233478b6deacd47145b441 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 20 Sep 2018 22:31:17 +0200 Subject: [PATCH] [bash] fix prompt for nested shells We need to determine and correct the level before we build the prompt. --- bashrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 5f885e9..44e288d 100644 --- a/bashrc +++ b/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))