On Thu, 2015-03-26 at 16:54 -0400, Chet Ramey wrote: > The solution cannot be bash-specific; the history library is used by many > other applications. One, design-wise ugly, idea: Couldn't you abuse the history comment char another time for that? Like consider anything between a ^#[[:digit:]] to be part of one command:
With HISTTIMEFORMAT set that could look like: #1427416260 echo foo #1427416363 if true; then echo bar fi #1427416625 ./and_so_on If HISTTIMEFORMAT is not set, you could simply write 0 #0 echo foo #0 if true; then echo bar fi #0 ./and_so_on AFAICS, this wouldn't break compatibility - anything that matches ^#[[:digit:]] is already now not stored in the history files, AFAICS - of course one would probably need to clear the history when one enables the shopt for using the above schema (or otherwise one could see extremely big multiline commands) Or one may just start with that way of parsing the file, the first time a ^#[[:digit:]] is encountered, and anything before is considered to be single commands per line. Cheers, Chris.