On 27 February 2013 10:52, Rajeev R. K. <[email protected]> wrote: >> How about: >> >> if [ $( grep -cE '/(home|backup)' /etc/mtab ) = 2 ]; then >> echo Found both mounts >> else >> echo Found only one of the two mounts >> fi >> >> (Refine as per your needs) >> > > Fails for Case where mount points /home and /home_new exist. Still get > count 2 with no backup. In addition, if i have /backup mounted too,
Come on man, that's why I specifically mentioned "refine to your needs". If I were to refine this for Rony's needs as he articulated, I'd write that regex as: '^[^[:space:]]*[[:space:]]/(home|backup)[[:space:]]' Which covers all the special cases you mention and some more. Binand -- http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

