shell 脚本小问题求解!
发表于 : 2012-02-06 22:46
今天在shell 练习脚本的时候发现:
我输入: ./process.sh Usage process.sh
为什么输出为这个:
echo "Usage:$0 string file";
Found "Usage" in process.sh ?? 难道是Ubuntu的问题?
代码: 全选
#!/bin/bash
if [ $# -ne 2 ];
then
echo "Usage:$0 string file";
exit 1;
fi
grep $1 $2;
if [ $? -ne 0 ];
then
echo "Not Found \"$1\" in $2";
exit 1;
fi
echo "Found \"$1\" in $2"
为什么输出为这个:
echo "Usage:$0 string file";
Found "Usage" in process.sh ?? 难道是Ubuntu的问题?