该$(foo)
构造将运行命令foo
并替换$(foo)
为running的输出foo
。您想要一个全局,这不是命令。您正在尝试运行名为的所有文件./zebu.work.post_opt/ZEBU_CTO_FT_MOD*
。所有你需要的是:
if [ -f zebu.work.post_opt/ZEBU_CTO_FT_MOD.v ]
then
for file in ./zebu.work.post_opt/ZEBU_CTO_FT_MOD*;
do
perl -i -p -e 's/input/inout/g' "$file"
perl -i -p -e 's/output/inout/g' "$file"
perl -i -p -e 's/wire.*\n/tran\(i0,\ o\);/g' "$file"
perl -i -p -e 's/assign.*\n//g' "$file"
done
fi
或者,更简单地说:
if [ -f zebu.work.post_opt/ZEBU_CTO_FT_MOD.v ]
then
for file in ./zebu.work.post_opt/ZEBU_CTO_FT_MOD*;
do
perl -i -p -e 's/input/inout/g; s/output/inout/g;
s/wire.*\n/tran\(i0,\ o\);/g;
s/assign.*\n//g' "$file"
done
fi
或更简单地说:
if [ -f zebu.work.post_opt/ZEBU_CTO_FT_MOD.v ]
then
perl -i -p -e 's/input/inout/g; s/output/inout/g;
s/wire.*\n/tran\(i0,\ o\);/g;
s/assign.*\n//g' ./zebu.work.post_opt/ZEBU_CTO_FT_MOD*
fi
$(...)
文件名周围的环绕样式。您不需要那里的命令替换。您也可以将四个Perl调用合并为一个,以提高速度。