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 c...@case.edu http://tiswww.cwru.edu/~chet/