On Tuesday 07 November 2006 21:14, Francesco Riosa wrote:
> mounts=( $(</proc/mounts) )
> for m in 0 6 12 ; do
>   [[ "${mounts[${m}]}" == "/dev/root" ]] \
>   && echo "Yay, I matched ^/dev/root "
> done

Good, but you fail due to only matching 3 lines

mounts=( $(</proc/mounts) )
i=0
while [[ -n ${mounts[i]} ]] ; do
  [[ "${mounts[${m}]}" == "/dev/root" ]] \
  && echo "Yay, I matched ^/dev/root "
  ((i+=6))
done

Should work (typed into mail, not actually tested). However, this does rely on 
a fixed number of 6 words per line, otherwise it breaks ;)
But as you say,  =~ would be faster as bash is notorious for slow loops

-- 
Roy Marples <[EMAIL PROTECTED]>
Gentoo/Linux Developer (baselayout, networking)
-- 
gentoo-dev@gentoo.org mailing list

Reply via email to