diff options
author | David Thompson <davet@gnu.org> | 2015-06-09 19:58:32 -0400 |
---|---|---|
committer | David Thompson <davet@gnu.org> | 2015-06-09 19:58:53 -0400 |
commit | a4bc7c4a75c89764deb3d1eae869a8babd2c2c4e (patch) | |
tree | c49406683b6ab752534259f2e2e27da32868b1c2 | |
parent | b3e61beee6aa34722e5e94f512782dd50c8b6933 (diff) |
bash: Display shell level in $PS1.
-rw-r--r-- | dotfiles/.bashrc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 950ef3c..58cb607 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -33,8 +33,17 @@ shopt -s checkwinsize # files and zero or more directories and subdirectories. shopt -s globstar -PS1='\u@\h \w\$ ' +# Add the shell level to PS1 if we're in a deeply nested shell. +if [ $SHLVL -gt 3 ] +then + # A tty in a terminal emulator is typically at shell level 3. + ((level = $SHLVL - 3)) + PS1='\u@\h \w [$level]\$ ' +else + PS1='\u@\h \w\$ ' +fi + alias ls='ls -p --color' alias ll='ls -l' -alias guix-dev-env="cd Code/guix; guix environment -e '(@@ (gnu packages package-management) guix-devel)'" +alias guix-dev-env="cd ~/Code/guix; guix environment -e '(@@ (gnu packages package-management) guix-devel)'" |