Roy Marples ha scritto: > > [[ $(</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 > using the == operator and/or quoting. > Remember, /dev/root/foo and /dev/foo /dev/root must not match either.
mounts=( $(</proc/mounts) ) for m in 0 6 12 ; do [[ "${mounts[${m}]}" == "/dev/root" ]] \ && echo "Yay, I matched ^/dev/root " done don't know which is faster/safer (bet on ~=) -- gentoo-dev@gentoo.org mailing list