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.

5
  • 6
    If you're outputting a usage message in response to an incorrect invocation, you would normally send that message to standard error instead of standard output, with echo >&2 ...
    – Mark Reed
    Commented Jun 10, 2012 at 17:05
  • 3
    @MarkReed The usage message is output by typing --help (which should go to standard out). Commented Jun 12, 2012 at 10:00
  • 3
    For others who come along, more info about "here documents" is available: tldp.org/LDP/abs/html/here-docs.html Commented Dec 31, 2015 at 8:08
  • 1
    Check the printf-based solution from Gordon Davidson. Despite being in the shadow of the echo or cat based approaches, it seems to be much less of a kludge. Admittedly the `printf' syntax represent a bit of a learning curve, but I'd like to ear of other drawbacks (? compatibility, performance ? ...)
    – mjv
    Commented Apr 26, 2017 at 23:49
  • 1
    Related: stackoverflow.com/questions/23929235/… Commented Oct 22, 2017 at 10:03