Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Personally I think some more detailed explanation of why this is preferred would enhance this answer, but yeah, this is the approach I use in real scripts. Commented Nov 17 at 18:46
  • Thanks for the answer kind user! I will use your method in the future for other projects, but wanted to implement verbose error handling which I forgot to mention in the original post. Thanks for your time :) Commented Nov 18 at 4:15
  • @DavidZ: Answer updated, Not sure exactly what you mean but I gave it a shot. Commented Nov 18 at 15:31
  • @EmberNeurosis: I amended the answer to address what I think you seek. Commented Nov 18 at 15:32
  • I suspect that croak would be improved by exec >&2 early on, given the args seem intended for standard error stream. Commented Nov 18 at 16:50