1 |
On Tue, Nov 07, 2006 at 08:47:18PM +0000, Roy Marples wrote: |
2 |
> On Tuesday 07 November 2006 20:32, Drake Wyrm wrote: |
3 |
> > I could be missing something, but: |
4 |
> > |
5 |
> > [[ $'\nwombat' =~ $'wombat' ]] && \ |
6 |
> > echo "These compare as equal, with or without the leading \n" |
7 |
> |
8 |
> A working example in bash-3.2 :) |
9 |
> |
10 |
> [[ $(</proc/mounts) =~ $'\n'/dev/root\ ]] \ |
11 |
> && echo "Yay, I matched ^/dev/root " |
12 |
> |
13 |
> I challenge you to get an exact match of /dev/root being on the first line |
14 |
|
15 |
You mean being first on a line, right? |
16 |
|
17 |
> using the == operator and/or quoting. |
18 |
> Remember, /dev/root/foo and /dev/foo /dev/root must not match either. |
19 |
> |
20 |
> If you can you get credit in the ChangeLog :) |
21 |
|
22 |
[[ " |
23 |
$(</proc/mounts)" == *" |
24 |
/dev/root "* ]] && echo "Yay, I matched ^/dev/root" |
25 |
|
26 |
You can use $'\n' instead of actual newline characters, of course. |
27 |
-- |
28 |
gentoo-dev@g.o mailing list |