比较空字符串cshell

时间:2017-07-26 02:23:31

标签: linux unix csh

我在比较从grep文件中检测到的空字符串时遇到问题。 我想检测搜索到第一个if条件的空文件,但是文件i搜索为空,它不能进入​​if($ vg =="")然后条件来回显输出并执行cp条件。

我用来查找文件的代码:

set lvg =`find ${lward}/netlists/verilog/ -name "${subblock}.v"`

以下是代码:

foreach vg (${lvg})
 if ($vg == "") then
   echo "${subblock}.vg file not found"
 else if (${vg} =~ "*/${subblock}.vg") then
   cp -r "$vg" ./primetime/design/verilog/${subblock}.v
 endif 
end

0 个答案:

没有答案