Linux Shell

http://baike.baidu.com/link?url=2LxUhKzlh5xBUgQrS0JEc61xi761nvCS7SHJsa1U1SkVbw3CC869AoUCyKT0zxIM

# Sample.sh
# 判断参数个数和第2/3个参数,括号要留空格
1 if ( [ $# != ] && [ $# != ] ) || ( [ $ != "-Path" ] && [ $ != "-Path" ] )
then
echo "example: ***"
exit
fi

if [ $ == "set" ] && [ $ == "-pm" ]
then
# bash/pdksh不能在等号两侧留下空格
PATH=$4
else
PATH=$3
fi
# 删除已经存在文件
14 if [ -e $PATH/out.txt ]
then
rm $PATH/out.txt
fi
# 调用程序
19 if [ $ == "set" ] && [ $ == "-pm" ]
then
$/sample.sh $ $ -Path $/config $ $
else
$/sample.sh $ -Path $/config $ $
fi
04-19 19:19
查看更多