summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2021-01-27 16:24:47 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2021-02-08 15:34:27 +0000
commit735d82f0eed0b47d38f86a63ede0e523c18eab09 (patch)
treee180d1ff2a71138e71bb6f0d2b6be88480070ba3 /usr/src
parentf4fe62a3c26a7b15283589c57a3c10ed9695b529 (diff)
downloadillumos-joyent-735d82f0eed0b47d38f86a63ede0e523c18eab09.tar.gz
13479 /etc/ksh.kshrc prompt could work with set nounset
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/nsadmin/ksh.kshrc10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr/src/cmd/nsadmin/ksh.kshrc b/usr/src/cmd/nsadmin/ksh.kshrc
index ea3826223d..568857311c 100644
--- a/usr/src/cmd/nsadmin/ksh.kshrc
+++ b/usr/src/cmd/nsadmin/ksh.kshrc
@@ -67,17 +67,17 @@ fi
# unless PS1 gets "unset" first.
# - Make sure to use absolute paths (e.g. /usr/bin/hostname) to make
# sure PS1 works in cases where PATH does not contain /usr/bin/
-if [[ "$(set)" != ~(E)PS1= && "${PS1}" == '' ]] ; then
+if [[ "$(set)" != ~(E)PS1= && -z "${PS1-}" ]] ; then
PS1='$(set +o xtrace +o errexit
- printf "%*s\r%s" COLUMNS ""
- printf "%s@%s:" "${LOGNAME}" "$(/usr/bin/hostname)"
+ [[ -v COLUMNS ]] && printf "%*s\r%s" COLUMNS ""
+ printf "%s@%s:" "${LOGNAME-}" "$(/usr/bin/hostname)"
ellip="${
- [[ "${LC_ALL}/${LANG}" == ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] &&
+ [[ "${LC_ALL-}/${LANG-}" == ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] &&
printf "\u[2026]\n" || print "..." ; }"
p="${PWD/~(El)${HOME}/\~}"
(( ${#p} > 30 )) &&
print -r -n -- "${ellip}${p:${#p}-30:30}" ||
print -r -n -- "${p}"
- [[ "${LOGNAME}" == "root" ]] && print -n "# " || print -n "\$ "
+ [[ "${LOGNAME-}" == "root" ]] && print -n "# " || print -n "\$ "
)'
fi