代码: 全选
#!/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的问题?