How to output a multiline string in Bash?

后端 未结 9 1642
忘了有多久
忘了有多久 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:35

    Here documents are often used for this purpose.

    cat << EOF
    usage: up [--level | -n ][--help][--version]
    
    Report bugs to: 
    up home page:
    EOF
    

    They are supported in all Bourne-derived shells including all versions of Bash.

提交回复
热议问题