diff options
-rw-r--r-- | ksh/kshrc.d/prompt.ksh | 14 |
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 |