Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Mike
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

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Will Mengarini via beginners
* Martin McCormick [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

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread karl
You can check if something is mounted by comparing which device a specific directory is on and comparing it to its parent directory. $ cat chk_mount.pl #!/usr/bin/perl -w use strict; use Fcntl ':mode'; my $A = $ARGV[0] // "/"; my $B = $ARGV[1] // "/var"; my @Ast = stat $A; my @Bst = stat $B;

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Jesús Lozano Mosterín
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 mount