osascript命令中的Bash expand变量
有人能告诉我如何使变量在下面展开吗osascript命令中的Bash expand变量,bash,Bash,有人能告诉我如何使变量在下面展开吗 MESSAGE="Public IP Address has changed" osascript -e 'tell application (path to frontmost application as text) to display \ dialog "My message is ${MESSAGE} " buttons {"OK"} with icon stop' 单引号阻止变量扩展: 我在这里使用shell字符串连接: 单引号用于关闭单引号字
MESSAGE="Public IP Address has changed"
osascript -e 'tell application (path to frontmost application as text) to display \
dialog "My message is ${MESSAGE} " buttons {"OK"} with icon stop'
单引号阻止变量扩展: 我在这里使用shell字符串连接: 单引号用于关闭单引号字符串的第一部分, 变量在双引号内展开, 单引号打开单引号字符串的最后一部分。
欢迎使用堆栈溢出!如果你能通过编辑多解释一下你的问题,那就太好了。谢谢此外,在单个引用字符串的中间,不能使用带有转义换行符的行继续。
MESSAGE="Public IP Address has changed"
osascript -e 'tell application (path to frontmost application as text) to display \
dialog "My message is '"$MESSAGE"' " buttons {"OK"} with icon stop'
# ....................^^........^^