On 4/14/19 9:40 PM, Paul Wise wrote: > On Sun, 2019-04-14 at 17:28 -0400, Chet Ramey wrote: > >> That's the number of positional parameters. > > Oops, I mean the command number variable \# that is available at PS1 > evaluation time but not when PROMPT_COMMAND is run. I was able to > workaround this by deferring the decision to display the status until > the PS1 evaluation time and using math functions to access and store > the command number variable \# to a normal variable.
You can use $HISTCMD with a slight fix that's now in the devel branch. > >> Syntax errors set $? to 2. SIGINT at the prompt sets $? to 130. There's >> no way to determine whether or not those exit statuses differ from an >> exit status resulting from a command being run. > > I managed to workaround this with some heuristics but it would be much > nicer to be able to properly differentiate between these cases. The Korn shell uses values > 256 to denote `internal' shell exit statuses, but that violates POSIX. > >> PIPESTATUS doesn't get set until a job completes. $? will be reset to >> 128+SIGNUM when a job stops, since that is what shells do and it seems >> reasonable as a way to let the user know a job suspended. It doesn't seem >> particularly useful to set PIPESTATUS to, e.g., {146, 146, 146} in this >> case, though. > > Having the former value of PIPESTATUS when $? has been reset doesn't > seem useful either, I think it would be better to unset PIPESTATUS when > setting $? but not PIPESTATUS if you aren't going to set PIPESTATUS. I'll keep that in mind for a future version. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/