El 5/6/24 a las 22:28, Mike escribió:

I sure couldn't figure out how to test for a mount
with that module.  And I did go to 'man 2 mount'.
Still couldn't figure it out.


Mike


On 6/1/24 18:29, Jeff P via beginners wrote:



Of course, I can use system calls and call the unix mount
or mountpoint applications but is there a proper perl way to do
this since system calls are not as elegant?  Thank you.

How about this module from metacpan?
https://metacpan.org/pod/Sys::Linux::Mount

regards.



Try:


my $out = `mount | tail -n 1` ;

if ( $out =~ /\/dev\/sdb1/ ) {

         say '/dev/sdb1 mounted!';

}else{

         die "Mount failed";

}


Best regards,


Jesús



--
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