aboutsummaryrefslogtreecommitdiff
path: root/ksh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-18 13:11:17 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-18 13:11:17 +1300
commitadcd0417a7fefb684c575e6fe0972adeb52d5de3 (patch)
treead24f4eb0fa30c4dbc175753a2c34cc94fc57ccd /ksh
parent09bc29e2dbeadc811491f555e71397dfa0264704 (diff)
downloaddotfiles-adcd0417a7fefb684c575e6fe0972adeb52d5de3.tar.gz
Add ksh version distinguisher to prompt
Diffstat (limited to 'ksh')
-rw-r--r--ksh/kshrc.d/prompt.ksh14
1 files changed, 12 insertions, 2 deletions
diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh
index e8705a8e..32bb8192 100644
--- a/ksh/kshrc.d/prompt.ksh
+++ b/ksh/kshrc.d/prompt.ksh
@@ -19,8 +19,8 @@ function prompt {
fi
# Add sub-commands; working directory with ~ abbreviation, VCS,
- # job, and return status checks
- PS1=$PS1'$(prompt pwd)$(prompt vcs)$(prompt job)'
+ # job, and ksh version code
+ PS1=$PS1'$(prompt pwd)$(prompt vcs)$(prompt job)$(prompt ver)'
# If this is PDKSH, add the exit code of the previous command; this
# doesn't seem to work on ksh93, probably different timing for when
@@ -203,6 +203,16 @@ function prompt {
((jobc)) && printf '{%u}' "$jobc"
;;
+ # Show a short code denoting the ksh flavour, if it can be gleaned from
+ # KSH_VERSION
+ ver)
+ case $KSH_VERSION in
+ *'PD KSH'*) printf %s ':pd' ;;
+ *'MIRBSD KSH'*) printf %s ':mk' ;;
+ *' 93'*) printf %s ':93' ;;
+ esac
+ ;;
+
# Print error
*)
printf 'prompt: Unknown command %s\n' "$1" >&2