击:从变量扩大参数。怎么样? [英] Bash: expand parameters from variable. How?
本文介绍了击:从变量扩大参数。怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想扩大焦油参数 - 排除
直通像变量:
I want to expand tar parameter --exclude
thru variable like:
set -x verbose
EXC=AAA,BBB
echo --exclude={$EXC} > /dev/null
输出:回声'--exclude = {AAA,BBB}
但我希望:呼应--exclude = AAA --exclude = BBB
我尝试了不同的调用,但没有..
什么错?
I tried different invocations, but nothing.. Whats wrong?
推荐答案
您需要使用评估
替换变量之后解析就行了。
You need to use eval
to parse the line after substituting the variable.
eval "echo --exclude={$EXC}"
这篇关于击:从变量扩大参数。怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文