Bash:单引号中的变量

我现在想在“摘要”中添加一个变量$ {date}:

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy \

--tags 'currency of the internet' \

--summary $'Today is ${date}. Poor whiskers takes a tumble.\nShe'\''s fine, though, don'\''t worry.'

但是变量不会在bash中的单引号内扩展。

有可能这样做吗?

注意:GoogleCL是用python编写的命令行程序。我在使用Python

2.6的Ubuntu 10.10上。

回答:

我将在列表中添加另一个选项:将变量定义为换行符,然后在双引号中使用该变量。

nl=$'\n'

...

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

以上是 Bash:单引号中的变量 的全部内容, 来源链接: utcz.com/qa/428971.html

回到顶部