On 6/14/16 8:52 AM, Néstor Tejero wrote: > When printing a multi-line string and piping to another command that uses > single-quotes, Bash tries to perform history expansion: > > echo "9 >> 10 >> 9 >> 11" | awk '!seen[$0]++' > bash: !seen[$0]++': event not found
History expansion is explicitly line-oriented. It doesn't know about shell state, especially shell quoting state, that spans lines. It does know about vaguely shell-like quoting that's common across a large set of Unix utilities -- since the history and readline libraries are used outside the shell -- and that a double quote introduces a quoted string in which single quotes are not significant and don't inhibit history expansion. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/