I was under the impression that within single quotes, e.g. 'pattern'
, bash special characters are not interpolated, so one need only escape single quotes themselves.
Why then does echo "123" | grep '[0-9]+'
output nothing, whereas echo "123" | grep '[0-9]\+'
(plus sign escaped) output 123
? (Likewise, echo "123" | grep '3|4'
outputs nothing unless you escape the |
.)
This is under bash 4.1.2 and grep 2.6.3 on CentOS 6.5.