On 3/17/17 5:43 PM, Grisha Levit wrote:
> Fair enough; sorry for the vague report. I thought it was surprising that:
>
> 1. \! and \# increment at different times during command entry
OK, I see what you mean. They are incremented at different times, and by
different "agents". The command number (\#) is incremented after the shell
parses a complete command and before it is executed. The history number
(\!) increments when the first line of the command is read and returned and
bash calls add_history. It's the result of the division of responsibility
between bash and readline. The shell is the one responsible for adding
subsequent lines to the first history entry (`command-oriented history'),
so the history library has done it's job: it's incremented the history
number and is waiting for the next call to add_history().
Maybe the shell could special-case \! for the second and subsequent lines
of a multi-line command, but that seems tricky to get right.
How would you suggest capturing this in the documentation in a way that
would be clearer? The text from your previous message or something else?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/