Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I would like to know how to check whether a system command has worked.
The system command attempts to mount a floppy on a Linux machine, and if it is successful, do some stuff.
The code I have used is as follows:
The error message gets displayed the first time, but not the second time.if (system "sudo /bin/mount /dev/fd0 /mnt/floppy") {# do some stuff} else {# display an error message}
Thanks,
CJ
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: checking on a system process
by bgreenlee (Friar) on Aug 19, 2004 at 10:29 UTC | |
|
Re: checking on a system process
by hanenkamp (Pilgrim) on Aug 19, 2004 at 11:42 UTC | |
|
Re: checking on a system process
by Random_Walk (Prior) on Aug 19, 2004 at 10:25 UTC |