Gentoo Archives: gentoo-dev

From: Francesco Riosa <vivo@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon
Date: Tue, 07 Nov 2006 21:13:06
Message-Id: 4550F73C.4070800@gentoo.org
In Reply to: Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon by Roy Marples
1 Roy Marples ha scritto:
2 >
3 > [[ $(</proc/mounts) =~ $'\n'/dev/root\ ]] \
4 > && echo "Yay, I matched ^/dev/root "
5 >
6 > I challenge you to get an exact match of /dev/root being on the first line
7 > using the == operator and/or quoting.
8 > Remember, /dev/root/foo and /dev/foo /dev/root must not match either.
9
10 mounts=( $(</proc/mounts) )
11 for m in 0 6 12 ; do
12 [[ "${mounts[${m}]}" == "/dev/root" ]] \
13 && echo "Yay, I matched ^/dev/root "
14 done
15
16 don't know which is faster/safer (bet on ~=)
17 --
18 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] baselayout-1.13 going into ~ARCH soon Roy Marples <uberlord@g.o>