- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] Perls of wisdom???
- From: Jeff Waugh <jdub@xxxxxxxxxxxxxx>
- Date: Tue Sep 10 14:41:02 2002
- User-agent: Mutt/1.4i
<quote who="Tony Green">
> > > How do I tell in perl-speak (ie without rewriting the whole thing in
> > > Java) that the mount point succeeded.
> >
> > How about grepping the output of 'mount' for the mountpoint? That's how I'd
> > do it in bash. :-)
>
> You can use the return codes - just like $? in shell programming.
>
> Example :
> if ( system("mount -t smbfs remoteserver:/mntpoint /mnt 2>/dev/null
> 1>/dev/null"))
Tony and I bantered about this on IRC. Checking the return code is always a
good idea, but I would personally check the output of mount too, as the
error code might not indicate that you don't have a valid mount (already
mount, etc.).
But yes, *always* check error codes in your scripts... Saves face later. ;)
- Jeff
--
"What inspired you to become a bus driver?"
"Linus Torvalds."