]> git.phdru.name Git - dotfiles.git/commitdiff
bash: Append `$SHLVL` directly to `$OPS1`
authorOleg Broytman <phd@phdru.name>
Fri, 12 Jun 2020 18:39:40 +0000 (21:39 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 12 Jun 2020 19:05:46 +0000 (22:05 +0300)
.profile
.shellrc
admin/prog/bash_prompt

index 69491d008216d3d0b20d0a37d316b529e96382bd..20ba5a1aef033a63a6051670938bfb7a3e5a7f16 100644 (file)
--- a/.profile
+++ b/.profile
@@ -175,8 +175,6 @@ if [ -t 0 ] ; then
    fi
 
    if test -n "$BASH_VERSION"; then
-      . "$ENV"
-
       if [ -r "$HOME"/admin/prog/bash_prompt ]; then
          . "$HOME"/admin/prog/bash_prompt
          set_prompts
@@ -185,12 +183,12 @@ if [ -t 0 ] ; then
          OPS1="${debian_chroot:+($debian_chroot)}\u@\h:\W \\$"
       fi
 
+      . "$ENV"
+
    else
       OPS1="${debian_chroot:+($debian_chroot)}`/usr/bin/whoami`@`/bin/hostname -s` >"
    fi
 
-   export OPS1
-
    ### biff controls new mail notification
    #biff n
    ### mesg controls messages (write/talk) from other users
index 6973d7ab0a04a70423b66f9290b2eb96a8a18ccb..bc164f1a305a08561600ff07a98d2340e8a79da8 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -57,8 +57,6 @@ case "$HOME" in
    ;;
 esac
 
-PS1="$OPS1$SHLVL "
-
 if test -n "$BASH_VERSION"; then
    [ "`type -t ls`" = alias ] && unalias ls
    [ "`type -t ll`" = alias ] && unalias ll
@@ -156,8 +154,6 @@ if test -n "$BASH_VERSION"; then
       . "$HOME"/admin/prog/bash_prompt
    fi
 
-   PS1="\`cgmem_which_prompt\`$OPS1$SHLVL "
-
    #if type -p pip >/dev/null 2>&1; then
    #   eval "`pip completion --bash`"
    #   rm -rf /tmp/pip_build_"$USER"
@@ -184,6 +180,7 @@ elif test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
    j() { jobs; }
 fi
 
+PS1="$OPS1"
 
 # clear screen and history, logout
 chlo() { clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit; }
@@ -343,7 +340,8 @@ mc() {
    if test -n "$BASH_VERSION"; then
       MC_SAVE_OPS1="$OPS1"
       if [ "`type -t short_curdir`" = function ]; then
-         OPS1="\u@\${HOSTNAME::5}:\`short_curdir\` \\$"
+         OPS1="\`cgmem_which_prompt\`\u@\${HOSTNAME::5}:\`short_curdir\` "
+         OPS1+="\$(prompt_git)\\$\$SHLVL "
       else
          OPS1="\u@\h:\W \\$"
       fi
index a262e5e4bd32ce65a1a155ac9e6c7c2ff01ac0f5..7c6117ce49aee8e58262d395b2b85ac2e61c15f0 100644 (file)
@@ -97,8 +97,6 @@ set_prompts() {
    OPS1+="${debian_chroot:+($debian_chroot)}"
    OPS1+="\`cgmem_which_prompt\`\u@\${HOSTNAME::5}:\`short_curdir\` "
    OPS1+="\$(prompt_git)"
-   OPS1+="\\$"
+   OPS1+="\\$\$SHLVL "
+   export OPS1
 }
-
-#set_prompts
-#unset set_prompts