非常简单:如何进行这项工作:
export predicate='[[ $LINE $arg ]]'
export LINE=10
export arg='-gt 3'
eval $predicate
产生:
eval "${predicate}"
bash: conditional binary operator expected
bash: syntax error near `$arg'
bash -x -c 'eval "${predicate}"'
尝试2:
$ eval $(echo ${predicate})
bash: conditional binary operator expected
bash: syntax error near `$arg'
尝试3:
+ eval '[[ $LINE $arg ]]'
bash: eval: line 0: conditional binary operator expected
bash: eval: line 0: syntax error near `$arg'
bash: eval: line 0: `[[ $LINE $arg ]]'
根本就没有扩展这些变量。