Bash: Variable in single quote

后端 未结 3 957
逝去的感伤
逝去的感伤 2020-12-11 07:35

First take a look at this question: Bash or GoogleCL: new line in a string parameter

I want to add a variable ${date} into the \"summary\" now:

googl         


        
3条回答
  •  渐次进展
    2020-12-11 08:06

    I'll add yet another option to the list: define a variable as newline, then use that inside double-quotes.

    nl=$'\n'
    ...
       --summary "Today is ${date}. Poor whiskers takes a tumble.${nl}She's fine, though, don't worry."
    

提交回复
热议问题