Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Robert Elz 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: References: <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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <2429.1588602246@jinx.noi.kre.to> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16278 Date: Mon, 4 May 2020 08:58:08 -0400 From: Chet Ramey Message-ID: | 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