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


Groups > gnu.bash.bug > #16278

Re: greater-than + number sign = newlines in history

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: greater-than + number sign = newlines in history
Date Mon, 04 May 2020 21:24:06 +0700
Lines 48
Approved bug-bash@gnu.org
Message-ID <mailman.2071.1588602273.3066.bug-bash@gnu.org> (permalink)
References <be89d8aa-e9db-bb3d-a874-b6d1e2a57790@case.edu> <bb08b099-59bd-5f04-4074-bbc046e99c6c@gmx.de> <2429.1588602246@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1588602273 20177 209.51.188.17 (4 May 2020 14:24:33 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To chet.ramey@case.edu
Envelope-to bug-bash@gnu.org
In-Reply-To <be89d8aa-e9db-bb3d-a874-b6d1e2a57790@case.edu>
Received-SPF permerror client-ip=2001:3c8:9009:181::2; envelope-from=kre@munnari.OZ.AU; helo=munnari.OZ.AU
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -18
X-Spam_score -1.9
X-Spam_bar -
X-Spam_report (-1.9 / 5.0 requ) BAYES_00=-1.9, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
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 <https://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>
X-Mailman-Original-Message-ID <2429.1588602246@jinx.noi.kre.to>
X-Mailman-Original-References <be89d8aa-e9db-bb3d-a874-b6d1e2a57790@case.edu> <bb08b099-59bd-5f04-4074-bbc046e99c6c@gmx.de>
Xref csiph.com gnu.bash.bug:16278

Show key headers only | View raw


    Date:        Mon, 4 May 2020 08:58:08 -0400
    From:        Chet Ramey <chet.ramey@case.edu>
    Message-ID:  <be89d8aa-e9db-bb3d-a874-b6d1e2a57790@case.edu>

  | The command-oriented history mode has to pay attention to those,   ['#']
  | because shell comments are one place where you can't
  | replace a newline with a semicolon.

That makes sense.

  | It just needs to also pay attention to
  | the fact that bash is reading a here-document.

There is more to it than that.

If I do (type):

	while sleep 4
	do
	echo abc#def
	done

(where the indentation is just for the e-mail), what bash puts in
history is

	while sleep 4; do echo abc#def
	done

(again indentation just for e-mail).   The # there is not a comment, and
if I quoted the arg to echo, I'd get

	while sleep 4; do echo "abc#def"; done

Only words starting with # need special treatment, not just any random '#'.
(The code is correctly executed, of course, and abc#def is printed every
4 secs.

However, while this one looks weird, it isn't actually incorrect,
unlike the here-doc one.

  | This was reported and fixed in October, 2019, and the fix is in the devel
  | branch.

That one probably deserves a patch.

kre

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


Thread

Re: greater-than + number sign = newlines in history Robert Elz <kre@munnari.OZ.AU> - 2020-05-04 21:24 +0700

csiph-web