2013-05-29 73 views
0

我有一个bash脚本,看起来像这样2变量:猛砸字符串格式化/替换

key='fox' 

string='The quick brown jumps over the lazy dog' 

我想创造一个插入的话brownjumps之间key一个新的变量。我怎样才能在bash中做到这一点?我是想这样的事情,但我无法得到它的工作:

sentence='The quick brown ${key} jumps over the lazy dog' 

句话的变量应该是:使用

sentence="The quick brown ${key} jumps over the lazy dog" 

string='The quick brown fox jumps over the lazy dog' 

回答