【发布时间】:2009-10-31 12:37:30
【问题描述】:
我编写了这个脚本,它计算给定文件中特定模式的出现次数。但是,如果文本文件包含方括号或花括号,shell 会输出消息“Missing }”。这是脚本:
#!/bin/csh
@ count=0
foreach word ( `cat test` )
if (`echo $word | egrep -c 'int'`) then
@ count= $count + 1
endif
end
echo $count
【问题讨论】:
标签: shell