17、Shell编程应用
时间:2007-06-11 来源:gis76748853
17、Shell编程应用
命令替换
echo 'date' 输出date命令结果
echo "The date is 'date'"
Example 1
echo "the date is 'date'"
expr 4 + 5 ##算数展开,有空格
echo $((4+5)) ##有无空格都可以
Example 2 CallCenter
#!/bin/bash
echo "Please enter Total number:"
read totalNumber
echo "Please enter resolve number:"
read resNunber
echo $((totalNumber-resNumber))
Example 3 Avg.sh
echo "Please enter score:"
read score
if test $score -lt 80
then
echo "Bad!!!"
elif test $score -ge 80 -a $score -lt 90
then
echo "Good!!"
else
echo "Very Good!!"
fi
vi编译器 set nu 显示行号
命令替换
echo 'date' 输出date命令结果
echo "The date is 'date'"
Example 1
echo "the date is 'date'"
expr 4 + 5 ##算数展开,有空格
echo $((4+5)) ##有无空格都可以
Example 2 CallCenter
#!/bin/bash
echo "Please enter Total number:"
read totalNumber
echo "Please enter resolve number:"
read resNunber
echo $((totalNumber-resNumber))
Example 3 Avg.sh
echo "Please enter score:"
read score
if test $score -lt 80
then
echo "Bad!!!"
elif test $score -ge 80 -a $score -lt 90
then
echo "Good!!"
else
echo "Very Good!!"
fi
vi编译器 set nu 显示行号
相关阅读 更多 +