On Tue, Nov 07, 2006 at 08:47:18PM +0000, Roy Marples wrote:
> 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"
> 
> A working example in bash-3.2 :)
> 
> [[ $(</proc/mounts) =~ $'\n'/dev/root\  ]] \
> && echo "Yay, I matched ^/dev/root "
> 
> I challenge you to get an exact match of /dev/root being on the first line 

You mean being first on a line, right?

> using the == operator and/or quoting.
> Remember, /dev/root/foo and /dev/foo /dev/root must not match either.
> 
> If you can you get credit in the ChangeLog :)

[[ "
$(</proc/mounts)" == *"
/dev/root "* ]] && echo "Yay, I matched ^/dev/root"

You can use $'\n' instead of actual newline characters, of course.
-- 
gentoo-dev@gentoo.org mailing list

Reply via email to