summaryrefslogtreecommitdiff
path: root/dotfiles/.bashrc
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2015-06-09 19:58:32 -0400
committerDavid Thompson <davet@gnu.org>2015-06-09 19:58:53 -0400
commita4bc7c4a75c89764deb3d1eae869a8babd2c2c4e (patch)
treec49406683b6ab752534259f2e2e27da32868b1c2 /dotfiles/.bashrc
parentb3e61beee6aa34722e5e94f512782dd50c8b6933 (diff)
bash: Display shell level in $PS1.
Diffstat (limited to 'dotfiles/.bashrc')
-rw-r--r--dotfiles/.bashrc13
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)'"