Roland Eggner wrote:
> $ bash --version
> GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
> 
> Description:
>       FEATURE REQUEST:
>       when storing history, skip failed commands depending on exit status, 
> controlled by a third option "ignorefailed" added to HISTCONTROL

Commands are stored in the history list well before being executed.  If
you would like to remove commands from the history based on exit status,
you are on the right track with testing $? in PROMPT_COMMAND.  Used with
`history -d', you can delete the previous command.  (The previous command
number can be obtained using $(history 1|awk '{print $1}') when
$PROMPT_COMMAND is executed.)

Keep in mind that commands evaluated while expanding $PS1 will change the
value of $?.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


Reply via email to