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 |