diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-09 23:39:12 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-09 23:39:12 +1300 |
commit | d08b4d4927baf35d2cee237909efe9106cc709e6 (patch) | |
tree | 7ffc6cb02ef21b379351d5254b9d576a4107dffb /pdksh/pdkshrc.d/prompt.pdksh | |
parent | Fix accuracy of comment (diff) | |
download | dotfiles-d08b4d4927baf35d2cee237909efe9106cc709e6.tar.gz dotfiles-d08b4d4927baf35d2cee237909efe9106cc709e6.zip |
Add prompt return behaviour to pdksh
Turns out this simple approach does actually work, though
I admit I do not fully understand why
Diffstat (limited to 'pdksh/pdkshrc.d/prompt.pdksh')
-rw-r--r-- | pdksh/pdkshrc.d/prompt.pdksh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh index 540ca9ac..63e965f9 100644 --- a/pdksh/pdkshrc.d/prompt.pdksh +++ b/pdksh/pdkshrc.d/prompt.pdksh @@ -23,7 +23,7 @@ prompt() { PS1=$PS1'\w' # Add sub-commands; VCS, job, and return status checks - PS1=$PS1'$(prompt vcs)$(prompt job)' + PS1=$PS1'$(prompt vcs)$(prompt job)$(prompt ret "$?")' # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -167,6 +167,12 @@ prompt() { done ;; + # Show return status of previous command in angle brackets, if not zero + ret) + local ret=$2 + ((ret)) && printf '<%u>' "$ret" + ;; + # Show the count of background jobs in curly brackets, if not zero job) typeset -i jobc |