diff options
| author | Mehdi Sadeghi <mehdi@mehdix.org> | 2022-06-07 08:06:48 +0200 |
|---|---|---|
| committer | Mehdi Sadeghi <mehdi@mehdix.org> | 2022-06-07 08:57:56 +0200 |
| commit | f8759897293de64c101a69bec3af2705b7c84902 (patch) | |
| tree | e5734dccee1b500acbdd8ce6b36d38873521da7b /.local/bin/prompt | |
| parent | dbb661005d7e6ccc0e33316323d02d60062be9a0 (diff) | |
Separate sh history. Add hist count to prompt.
sh history is written to ~/.sh_history now. The reason is that
I am chasing the cause of a history truncation issue.
Diffstat (limited to '.local/bin/prompt')
| -rwxr-xr-x | .local/bin/prompt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/.local/bin/prompt b/.local/bin/prompt index d4d6592..920a5ef 100755 --- a/.local/bin/prompt +++ b/.local/bin/prompt @@ -1,7 +1,8 @@ #!/bin/sh BRANCH=$(git branch --show-current 2>/dev/null) BRANCH=$(test -n "$BRANCH" && echo "($BRANCH)") -PROMPT="$USER@$(cat /proc/sys/kernel/hostname):$( test "$PWD" = $HOME && echo '~' || echo "$PWD")$BRANCH" +HIST_COUNT=$(grep -v '^#' ~/.bash_history | wc -l) +PROMPT="$USER@$(cat /proc/sys/kernel/hostname)[$HIST_COUNT]:$( test "$PWD" = $HOME && echo '~' || echo "$PWD")$BRANCH" case $(id -u) in 0) echo -e "$PROMPT\\n# " ;; *) echo -e "$PROMPT\\n$ " ;; |
