On Tuesday 07 November 2006 20:32, Drake Wyrm wrote:
> I could be missing something, but:
>
> [[ $'\nwombat' =~ $'wombat' ]] && \
> echo "These compare as equal, with or without the leading \n"
>
> They do not compare as equal with the == operator or the = operator. You
> probably want the = operator, because the == operator _does_ interpret
> the RHS as a glob. The = operator just uses simple string comparison,
> without interpreting anything.

Interesting. You just asked the regex(3) command if $'\nwombat' contains 
$'wombat'

Maybe you meant to write

[[ $'\n'wombat =~ wombat ]]
That will still return true

[[ wombat =~ $'\n'wombat ]]
Will return false, which is what we want as wombat isn't at the start of the 
line.

In my example, I'm trying to match something at the start of a line.

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo/Linux Developer (baselayout, networking)
-- 
gentoo-dev@gentoo.org mailing list

Reply via email to