1、参数传递,判定参数是否存在
#!/bin/bash
#
if [ $# -lt 1 ];then
echo "Usage:./filetest3.sh ARG1 [ARG2...]"
exit 7
fi
if [ -e $1 ];then
echo "Ok."
else
echo "No such file"
fi
2、计算两数之和及两数之积
#!/bin/bash
#
if [ $# -lt 2 ];then
echo "Usage:7.sh ARG1 ARG2 [ARG3...]"
exit 8
fi
echo "The sum is: $[$1+$2]"
echo "The prod is: $[$1*$2]"