How to output a multiline string in Bash?

后端 未结 9 1626
忘了有多久
忘了有多久 2021-01-29 18:14

How can I output a multipline string in Bash without using multiple echo calls like so:

echo \"usage: up [--level | -n ][--help][--version         


        
9条回答
  •  情歌与酒
    2021-01-29 18:53

    Use -e option, then you can print new line character with \n in the string.

    Sample (but not sure whether a good one or not)

    The fun thing is that -e option is not documented in MacOS's man page while still usable. It is documented in the man page of Linux.

提交回复
热议问题