* Martin McCormick <marti...@suddenlink.net> [24-06/01=Sa 09:25 -0500]:
> [...] determine whether a file system is mounted such as
> $ mount |grep horseradish
> [...]

I think
  perl -e 'print grep m[/horseradish],`mount`'
is hard to beat for its simplicity.  Note I'm using Perl's
built-in grep; there's no need to run the system's grep.

You can code something like
  --------------------------------
  if( grep m[/horseradish],`mount` ){
    useMountedHorseradish();
  }else{
    dealWithUnmountedHorseradish();
  }
  --------------------------------
because Perl's grep will return an empty string if 'horseradish'
isn't found in `mount`, and an empty string is logically false,
whereas any nonempty string is logically true.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to