Stewart Stremler wrote:
> begin  quoting John H. Robinson, IV as of Fri, Dec 22, 2006 at 09:46:23AM 
> -0800:
> > 
> > #!/usr/bin/perl -T -w
> > 
> > $ENV{PATH}="";
> > 
> > $ifc=qx(/sbin/ifconfig eth0);
> > 
> > if ($ifc =~ m/inet addr:([^ ]*)/) {
> >     print "$1\n";
> > } else {
> >     print "No match.\n"
> > }
> > 
> > exit 0;
> 
> Surely you'd want to exit with 0 or 1, depending on a match
> or not, so that you can more easily use your script in another,
> yes?

If I were to exit with a 1 upon failure, I would also dispense with the
printing of No match. When I wrote this, I was using hte input and
output as given to me on the spec sheet (the currently working program).

If I had my druthers, I would do the silent failure with an exit code of
non-zero (probably 1, unless I had a good reason otherwise).

-john

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to