Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.snarked.org!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 12:40:13 -0500 Lines: 36 Approved: bug-bash@gnu.org Message-ID: References: <8e690ee5-4afd-e45d-f3c5-8a69f61139dd@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1574098837 21137 209.51.188.17 (18 Nov 2019 17:40:37 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=Wcp67qOk42IHv1kb7tebvXqOcCkcCvC7y2X2xHXZvpE=; b=O4t7UgJ6cWd56HZ9h9OIQTv+0ggINq4lX+YTTfGW9lPSD/m5x4LuCerFtzR/TNYaV+ +JgggEhneMikddQdzj1OGOI5eOHAfiYkEhTfwCEQbJtq5FIPo+/hIsw0jjOWwFsWqQlS gi0b/c/DemssMENkGKsrnu+dVsqD4i/OdYBgm/XFhsJ6phl8kn0kYM2+xSn/202Qms8i hjMa/Knhf2/IxZXyrX7o/CfMARAy6qm9uje+Hvbn8XzOQcxph+cTqA1UzQCv46fzkuIg 6GOLtlYNmewjWDCp92wTyodobwQ8ZW8xmpoG2tRbn0BB26TytiecCH7PnW/jHVQ/BR0W JXXg== 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=Wcp67qOk42IHv1kb7tebvXqOcCkcCvC7y2X2xHXZvpE=; b=dp9DHRNG+FUc4+p8gvvu7UWT+4syvX6mWJj+DwaswsOtmsAwJhCmMk+ZGCW2GNnufw zkP0MDfQMv7HSJHhrd2F1zjeH9bdEXzKQZwlhOFGUhl+sQstuAkxatYxQCaOlxhi88Pd y4b3128YxlfOg72YUR06rTveYehtUL7QP+AbmyJzWJHkk0jbDDqSfJQokz5FOb6+VO+M E+rEFdtkSBLI37WdaB+zg8dgB3kf09kSpefT4RIe4EDTJiimKFLpztHt7lNaARnVpCae lj+2BgLcAh/00vcXBibQR4iuxefJYFnCYfSFhMPea0jOT9c/RFUURfPsMxk7nQqLNocR 1d1g== X-Gm-Message-State: APjAAAUYHjz9iExoN1fXM/yvNNGUSBN5UX/Lcb+V5ImZGdOUi8OMrXh2 2jqe1c8vSyIYCyBtAMx364wYchG29wl+bAuotNw= X-Google-Smtp-Source: APXvYqwZZUSNS1L6JGssV2YYYfMjnanjZ8JjJtpRFOkz2jRnBz5xxXcu4X6drQT+8Cd3m4G7YPwQyeeXKPCC9gr9ZiU= X-Received: by 2002:a6b:c98e:: with SMTP id z136mr2109277iof.15.1574098824841; Mon, 18 Nov 2019 09:40:24 -0800 (PST) In-Reply-To: <8e690ee5-4afd-e45d-f3c5-8a69f61139dd@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d2f 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: <8e690ee5-4afd-e45d-f3c5-8a69f61139dd@case.edu> Xref: csiph.com gnu.bash.bug:15607 Thank you for looking into all of these reports. My issue here was that in both cases there had not yet been any ?string? search, so they should behave the same way -- an event is not required to not have a most recent ?string? search. So if the default is to use an empty string as the previous string when there is none, for consistency from the perspective of the user, both instances of echo "!%" should output echo "" as the second one does. [root@localhost ~]# bash [root@localhost ~]# echo "!%" bash: !: event not found [root@localhost ~]# echo a >/dev/nul [root@localhost ~]# echo "!%" echo "" Jim On Mon, Nov 18, 2019 at 11:20 AM Chet Ramey wrote: > On 11/5/19 11:44 AM, Jim Monte wrote: > > The availability of the % string only after a command unrelated to it > (not > > using !??) is executed as shown below is not documented, but it probably > > falls under the category of a bug. That is, it seems reasonable that both > > echo "!%" commands should behave as the second one does. > > [root@localhost ~]# bash > > [root@localhost ~]# echo "!%" > > bash: !: event not found > > If there is no history list, and hence no history entries, there are no > events to find. Hence the error message. > > -- > ``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/ >