Some drive-by after-the-fact comments:
On 12/6/21 4:03 PM, Frank Steinmetzger wrote:
[ "$MC_SID" ] && PS1_JOBS_COUNT="${PS1_JOBS_COUNT}MC "
[ "$RANGER_LEVEL" ] && PS1_JOBS_COUNT="${PS1_JOBS_COUNT}R "
I've taken to using things like the following:
PS1_JOBS_COUNT="${PS1_JOBS_COUNT}${MC_SID:+MC }${RANGER_LEVEL:+R }"
Leverage Bash's (and Zsh's) expansion conditional. If the variable is
set, then expand it to a different value.
${VARIABLE:+alternate text to show if VARIABLE is set}
if [[ -z "$PROMPT_COMMAND" ]]; then
PROMPT_COMMAND=__jobsprompt
else
PROMPT_COMMAND="$PROMPT_COMMAND ; __jobsprompt"
fi
Is there a reason to not simply do the following, eliminating the if
conditional:
PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND} ; __jobsprompt}
--
Grant. . . .
unix || die