[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Quoted multiline command interpreted by history as separate commands
From: |
james harvey |
Subject: |
Quoted multiline command interpreted by history as separate commands |
Date: |
Sat, 26 Dec 2015 18:15:12 -0500 |
If I run
==========
cat >> usertmp <<EOF
> something here
> something else here
> EOF
==========
And I run history, I see:
==========
44 2015-12-26 17:27:42 cat >> usertmp <<EOF
something here
something else here
EOF
==========
BUT, if I exit and start a new bash, causing .bash_history to be
written and freshly read and parsed, then I run history, I see:
==========
50 2015-12-26 17:27:42 cat >> usertmp <<EOF
51 2015-12-26 17:31:37 something here
52 2015-12-26 17:31:37 something else here
53 2015-12-26 17:31:37 EOF
==========
It appears bash sends an executed quoted multiline command to the
in-memory history list as one command.
But, it appears bash when parsing .bash_history is unable to
distinguish quoted multiline commands from separate commands, and
reads them into the in-memory history list separately. Doing so, if
the user is using history timestamps, it appears to properly use the
timestamp for the first line, and improperly use the modified
timestamp on the .bash_history for subsequent lines.
---Full history customizations---
==========
shopt -s histappend
export HISTSIZE=-1
export HISTFILESIZE=-1
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
export HISTCONTROL=ignorespace
==========
- Quoted multiline command interpreted by history as separate commands,
james harvey <=