Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: best practices for checking system return values for piped commands?

by billh (Pilgrim)
on May 02, 2006 at 12:39 UTC ( #546873=note: print w/replies, xml ) Need Help??


in reply to best practices for checking system return values for piped commands?

Just to add a little to what others have said, 'true' is not the best possible choice for a 2nd command since:
1. it isn't reading it's stdin in so won't detect anything wrong.
2. 'true' tries its hardest to live up to its name, always exiting with status zero.
Bill H
perl -e 'print sub { "Hello @{[shift]}!\n" }->("World")'
  • Comment on Re: best practices for checking system return values for piped commands?
  • Download Code

Replies are listed 'Best First'.
Re^2: best practices for checking system return values for piped commands?
by markjugg (Curate) on May 04, 2006 at 15:27 UTC

    "true" is a great choice to illustrate my test, as it is a great example of an utility which "succeeds" even with no input piped to it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://546873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2016-10-01 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (9 votes). Check out past polls.