Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14583
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Unexpected "!$" history expansion after use of here-document |
| Date | 2018-09-15 14:52 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.823.1537038476.1284.bug-bash@gnu.org> (permalink) |
| References | <20180912001758.239A53745B@straasha.imrryr.org> |
On 9/11/18 8:17 PM, Viktor Dukhovni wrote: > > Bash Version: 4.4 > Patch Level: 23 > Release Status: release > > Description: > Intuitevely, (and confirmed behaviour of "csh" whose history > substitution bash emulates), after a command of the form: > > $ grep foo <<EOF > /tmp/bar > foobar > abcdef > EOF > > One would expect "!$" to be /tmp/bar, so that an immediate: > > $ wc -l !$ > > should expand to "wc -l /tmp/bar" and output "1". If you're using command-oriented history, which I surmise you are, the history entry is the entire previous command, with its embedded newlines. The last word is the final newline, since the embedded newlines count as words (which seems non-intuitive; I will have to look at that). I don't know what csh does, or why it seemingly throws away the rest of the command, but that's not how command-oriented history works in bash. Chet -- ``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/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Unexpected "!$" history expansion after use of here-document Chet Ramey <chet.ramey@case.edu> - 2018-09-15 14:52 -0400
csiph-web