Fred Snurd fredsn...@yahoo.com writes:
Git fans like to know what branch is current, and bash's implementation
of PS1 allows for update each time it is displayed. All of my attempts
of adding a call to a ksh function into PS1 appear to be evaluated at
the time that PS1 is set, but not upon each new display of the shell
prompt. Does anyone have suggestions on how to have ksh execute
a function upon each display of PS1?
Use single quotes, eg.
_ps1_err() {
local _rc=$?
[ $_rc -ne 0 ] printf %s $_red
return $_rc
}
PS1='\h \w\[$(_ps1_err)\]\$\[$_nc\] '
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE