in reply to Re^4: improve script
in thread improve script

Or just:

print( "$1\n" ), exit if /.../;

Or even:

die "$!\n" if /.../;

Which seems to capture the semantics perfectly.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^6: improve script
by LanX (Saint) on Nov 28, 2015 at 21:50 UTC
    > Which seems to capture the semantics perfectly.

    Yes, except it's printing to STDERR not STDOUT.

    That's complicating things if sh has to capture the output.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Yes, except it's printing to STDERR not STDOUT.

      Far more than you ever wanted to know about shell redirections

      That's complicating things if sh has to capture the output.

      No, only that way allows to cleanly separate usable data (STDOUT) from error messages (STDERR), without having to use heuristics (in other words: automated guessing).

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)