diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-18 13:11:17 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-18 13:11:17 +1300 |
commit | adcd0417a7fefb684c575e6fe0972adeb52d5de3 (patch) | |
tree | ad24f4eb0fa30c4dbc175753a2c34cc94fc57ccd /ksh/kshrc.d | |
parent | Change tack; force ENV if the file exists (diff) | |
download | dotfiles-adcd0417a7fefb684c575e6fe0972adeb52d5de3.tar.gz dotfiles-adcd0417a7fefb684c575e6fe0972adeb52d5de3.zip |
Add ksh version distinguisher to prompt
Diffstat (limited to 'ksh/kshrc.d')
-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 |