日期:2014-05-16 浏览次数:20736 次
#!/bin/sh
if [ "$1" = "" ]
then
echo -e "The first parameter can not be empty.\nPlease check the first parameter from your input."
#exit 1
elif [ "$2" = "" ]
then
echo -e "The second parameter can not be empty.\nPlease check the second parameter from your input."
#exit 2
elif [ "$3" = "" ]
then
echo -e "The third parameter can not be empty.\nPlease check the third parameter from your input."
#exit 3
elif [ "$4" = "" ]
then
echo -e "The fourth parameter is null.\nDefault output to current findReslut.txt file."
filelist=$(find $2 -name $3)
if [ "$filelist" != "" ]
then
grep -n $1 -r $filelist > findResult.txt
#exit 4
fi
else
filelist=$(find $2 -name $3)
if [ "$filelist" != "" ]
then
grep -n $1 -r $(find $2 -name $3) > $4
fi
fi
#!/bin/sh
if [ "$1" = "" ]
then
echo -e "The first parameter can not be empty.\nPlease check the first parameter from your input."
#exit 1
elif [ "$2" = "" ]
then
echo -e "The second parameter can not be empty.\nPlease check the second parameter from your input."
#exit 2
elif [ "$3" = "" ]
then
echo -e "The third parameter can not be empty.\nPlease check the third parameter from your input."
#exit 3
elif [ "$4" = "" ]
then
echo -e "The fourth parameter is null.\nDefault output to current findReslut.txt file."
filelist=$(find $2 -name $3)
if [ "$filelist" != "" ]
then
&