【发布时间】:2010-02-06 02:22:31
【问题描述】:
我有以下脚本
cat $1 | while read line
do
line=`echo $line | tr "[:lower:]" "[:upper:]"`
if [ "`echo $line | cut -f1 -d:`" = "foo" ] && \
[ "`echo $line | cut -f2 -d:`" = "bar" ]; then
echo 'exsist'
exit 1;
fi
done
一切都可以回显,然后当脚本退出时,它不会并继续运行。任何想法。
谢谢
【问题讨论】:
-
UUOC: 代替 cat $1 | while ... 你可以做 while ... done
-
-1 用于 UUOC 并为每一行使用外部命令。