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:53:15
Message-Id: 200611072047.41415.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 A working example in bash-3.2 :)
8
9 [[ $(</proc/mounts) =~ $'\n'/dev/root\ ]] \
10 && echo "Yay, I matched ^/dev/root "
11
12 I challenge you to get an exact match of /dev/root being on the first line
13 using the == operator and/or quoting.
14 Remember, /dev/root/foo and /dev/foo /dev/root must not match either.
15
16 If you can you get credit in the ChangeLog :)
17
18 Yes, you could also write
19 grep -E "^/dev/root " /proc/mounts, but using bash like this is faster [1]
20
21 [1] http://roy.marples.name/node/267
22
23 Thanks
24
25 --
26 Roy Marples <uberlord@g.o>
27 Gentoo/Linux Developer (baselayout, networking)
28 --
29 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon Francesco Riosa <vivo@g.o>
Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon "Harald van Dijk" <truedfx@g.o>