我的脚本如下:
var1=some_val1
var2=some_val2
var3=some_val3
varX=another_script.sh ${var1} ${var2} ${var3}
我收到以下错误:
./script.sh: line 5: some_val1: command not found
如何让它正常运行?该脚本基本上采用这些参数并运行Hive查询。如果我将Hive查询放回而不是another_script.sh blah blah blah
,它就可以完美地运行,变量会捕获该值,以便稍后在脚本中使用。我尝试交换它以使其更抽象,我遇到了这个问题。请帮忙。谢谢!
答案 0 :(得分:2)
替换
varX=another_script.sh ${var1} ${var2} ${var3}
通过
varX=$(another_script.sh ${var1} ${var2} ${var3})