Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way I can call a Unix mount command from within a Perl script?

Replies are listed 'Best First'.
Re: PVCS Admin
by chromatic (Archbishop) on May 19, 2000 at 23:03 UTC
    Here's how I'd do it:
    my $mountpath = '/mnt/floppy'; my $device = '/dev/fd0'; my $status = system("mount", $device, $mountpath); die "Mount failure for $device and $mountpath" unless ($status == 0);
    You might want to put your full path to mount in a variable too. I use the list format system call because it doesn't invoke the shell to parse the arguments. That's a little more secure.
Re: PVCS Admin
by BigJoe (Curate) on May 19, 2000 at 23:44 UTC
    Or if you are really lazy you can just do:
    my $status = `mount /dev/fd0 /mnt/floppy`;
RE: PVCS Admin
by vroom (His Eminence) on May 19, 2000 at 22:38 UTC