Iíll sometimes do this as an explicit pre-flight check. If so, itís either because:
I use this program deep in the code and I donít want to have to unroll a bunch of state (or fail and leave a broken mess) if I get halfway through and then find a critical external program is missing.
I want to be unusually user-friendly for a Unix program. Seriously, sometimes the failure that results ďnaturallyĒ is misleading and will leave the user (usually me) scratching their head and having to troubleshoot. I can save them (myself) a bunch of time if I simply tell them (me) what's wrong.
I agree thereís no point to checking for availability on the line before you try to run the program; you might as well just process the error from system or whatever.
Preliminary operational tests were inconclusive. (The damn thing blew up.)
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.