On 4/3/10 2:33 PM, pk wrote:
> Is the =~ operator supposed to recognize \n in patterns?
No. "\n" matching a newline is not part of regular expression syntax.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS
Is the =~ operator supposed to recognize \n in patterns? Example:
$ a='abc
def'
$ if [[ $a =~ c\nd ]]; then echo ok; fi
The above produces no output (I've tried using \\n, \\\n too), while using a
literal newline works:
$ if [[ $a =~ c$'\n'd ]]; then echo ok; fi
ok
Is that expected behavior o