Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #12123

Quoted multiline command interpreted by history as separate commands

From james harvey <jamespharvey20@gmail.com>
Newsgroups gnu.bash.bug
Subject Quoted multiline command interpreted by history as separate commands
Date 2015-12-26 18:15 -0500
Message-ID <mailman.1114.1451266285.843.bug-bash@gnu.org> (permalink)

Show all headers | View raw


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
==========

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Quoted multiline command interpreted by history as separate commands james harvey <jamespharvey20@gmail.com> - 2015-12-26 18:15 -0500

csiph-web