Gentoo Archives: gentoo-dev

From: Roy Marples <uberlord@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon
Date: Tue, 07 Nov 2006 20:59:42
Message-Id: 200611072051.47108.uberlord@gentoo.org
In Reply to: Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon by Drake Wyrm
1 On Tuesday 07 November 2006 20:32, Drake Wyrm wrote:
2 > I could be missing something, but:
3 >
4 > [[ $'\nwombat' =~ $'wombat' ]] && \
5 > echo "These compare as equal, with or without the leading \n"
6 >
7 > They do not compare as equal with the == operator or the = operator. You
8 > probably want the = operator, because the == operator _does_ interpret
9 > the RHS as a glob. The = operator just uses simple string comparison,
10 > without interpreting anything.
11
12 Interesting. You just asked the regex(3) command if $'\nwombat' contains
13 $'wombat'
14
15 Maybe you meant to write
16
17 [[ $'\n'wombat =~ wombat ]]
18 That will still return true
19
20 [[ wombat =~ $'\n'wombat ]]
21 Will return false, which is what we want as wombat isn't at the start of the
22 line.
23
24 In my example, I'm trying to match something at the start of a line.
25
26 --
27 Roy Marples <uberlord@g.o>
28 Gentoo/Linux Developer (baselayout, networking)
29 --
30 gentoo-dev@g.o mailing list