开发者

Create grep command dynamic and run from variable

I am trying to create regex dynamic开发者_高级运维ly and then run it, this is part of script

...
param="egrep $2 $1"
shift
shift
while [ $# -ne 0 ]
do
param="$param""|egrep $1"
shift
done
$param // here i get error
...

But echo for $param seems to me ok

.P F1 a b c // run script

egrep a F1| egrep b| egrep c

What should I do in order to run $param correctly?


try

eval $param


try: eval $cmd


0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜