Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Jim Monte Newsgroups: gnu.bash.bug Subject: Re: Issues with history substitution and its documentation Date: Mon, 18 Nov 2019 13:10:37 -0500 Lines: 63 Approved: bug-bash@gnu.org Message-ID: References: <643b95db-ca1f-98ff-e8c5-c79581d909d4@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1574100656 22230 209.51.188.17 (18 Nov 2019 18:10:56 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Chester Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RgWSygiCLiitbKtmhLiEX+yMZbGaxsie3MCAJ9/66t4=; b=ofNnmYYykzrm/N5QJCwPt8bZ2WYjKyQNKwfr16c9dCTPiB1DdFiyy2Gr3Iro0wp5VN slS59uxLF/RTUdye+eblS6ZdlA992zBP0St8t2qQaOSGNtFUVjwcfqIGD1LnCSRN24+l m8JqAsbmnVGHMTOuZiIep56KVIZ5+KIlMfBNAU9Vd5rsvoBDESCpmVyDARnrw55LrJ3J NgNzzxJZxC1pmh+50v4uSzWNEQHbQBedleMAMSIiveHEe/uItMa205r8eIVqKGOLf3uo nnioXHTHG0M+bBWmXJ1KeJdhYqTRyrSptrVMUadsyQxFsgmh6msUqrqsvNmbMAS1Zq3d muoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RgWSygiCLiitbKtmhLiEX+yMZbGaxsie3MCAJ9/66t4=; b=nelQzbXiX2/svhfShFx1I4gfqvCij14D80gyNUxDZ8fl0+TAHglzoNLzOnO03/A0rg 6j4IAKGmrUqeCrkH19aU748KK79dWspqlE6Wueo1sVE9bZ4ygxCRQk5a5e0E2+xV9Wbz chzYgYrzNfYYTXZBoh8cpVB0P32PZcNQdSKwalWOm4qyS8/Im2T+kDDsptDAzk2ASasG bpKwD0xUAgwWQAohaF3C7VzuCcrzFgKjx7hIMeVePed6sTy+PST2LjwwVIOk2ZWtxO4A IiPXeUyOY1YWkRHlrG6bWp5xuS54lk0ey6NHjyMIDcMGwM4LWoQnBRGfSrtMNQzjr/37 7fnQ== X-Gm-Message-State: APjAAAXJGkVUDs6/PvJ2Dno1KOEA/7JrCMiad2fCH0oRP+4ecITQhkGi Lunz6ux902zh0zM6b0J/eTBIDLu0ELCm/Ef+UqA= X-Google-Smtp-Source: APXvYqwO2evRfShC4lxWaCj22zkWkdizfFrMfmKvbBwWbRu95iO9rH8FrJsJVnvfi2oo26xqfJNciBW/63ENcV7LWe0= X-Received: by 2002:a02:880c:: with SMTP id r12mr14597411jai.100.1574100649800; Mon, 18 Nov 2019 10:10:49 -0800 (PST) In-Reply-To: <643b95db-ca1f-98ff-e8c5-c79581d909d4@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d2e X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: X-Mailman-Original-References: <643b95db-ca1f-98ff-e8c5-c79581d909d4@case.edu> Xref: csiph.com gnu.bash.bug:15608 Thanks again for looking at these reports. I have thankfully essentially completed my implementation of history for ngspice (an open-source successor to SPICE 3F5 with a csh-like front end that handles parsing a bit differently than a shell would), so I believe this report will be the final one. Jim Related to the other report, there is some more missing documentation regarding the :s word modifier. If the line ends after "old", it is equivalent to :s/old/new/ (assuming old and new do not contain '/'). If the line ends after the first delimiter, it is equivalent to :s///, i.e., the previous old pattern is used and new is an empty string. If the line ends after :s, no action is performed. [root@localhost ~]# echo a b c a b c [root@localhost ~]# echo !:s/a echo echo b c echo b c [root@localhost ~]# echo a b c a b c [root@localhost ~]# echo !:s/ echo echo b c echo b c [root@localhost ~]# echo a b c a b c [root@localhost ~]# echo !:s echo echo a b c echo a b c Jim On Mon, Nov 18, 2019 at 11:14 AM Chet Ramey wrote: > On 11/3/19 9:18 AM, Jim Monte wrote: > > Two more documentation issues I have found are below. > > > > It appears that an empty substring event designator uses the string of > the > > previous substring event designator if none is provided and does not find > > the event if there is no previous string. > > Thanks for the report. I'll add text documenting the behavior. (FWIW, csh > doesn't document it, either.) > > > > An empty "old" string in a substitute word modifier uses the previous > "old" > > if none is given, but uses an empty string if new is empty. If there was > no > > previous "old" string, an error is reported. > > As I said in a previous message, this is documented in the man page but > omitted in the texinfo manual. > > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/ >