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

Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From james harvey <jamespharvey20@gmail.com>
Newsgroups gnu.bash.bug
Subject Quoted multiline command interpreted by history as separate commands
Date Sat, 26 Dec 2015 18:15:12 -0500
Lines 44
Approved bug-bash@gnu.org
Message-ID <mailman.1114.1451266285.843.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace usenet.stanford.edu 1451266285 9999 208.118.235.17 (28 Dec 2015 01:31:25 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=tzjLERCZB3WeqjuWqaEtWFd/wIOWY18MddVMHhJ+C38=; b=Z9dCDcbd0XWVQYIS04irOn5vCOifw3hu0ddH9l1kxNtqQuaC5ZvySz2Xmdc+N56jKN 4rvgJjPdnHegqdpOReOSQ9Yd04xsfQtBaYcB+OPgTOJclmshRcKNUDPlLWN+Y/3mRAh4 nY5VRjBrFoJnWJIKznz6pR0yP3bIe+jkREKIGFtPLYYFAC8RQhbQsUk+hjJEimBk1+K3 IgyxDWF3czLMBP/DaCTwRypFOjTZUYOQhADNsPueKE4SNILpAAg8goVrOHCj7AMicahS gBLsjpImEtrU1sx78ZKlNvr3JNUuq6Akq7gmXqYEEanRFPSUBaqLEHGY/WtsbLAZ6HDD ILqA==
X-Received by 10.112.165.69 with SMTP id yw5mr16679652lbb.1.1451171713031; Sat, 26 Dec 2015 15:15:13 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 2a00:1450:4010:c04::22c
X-Mailman-Approved-At Sun, 27 Dec 2015 20:31:23 -0500
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:12123

Show key headers only | 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