您的位置:首页 > 运维架构 > Shell

shell脚本练习(12.8)

2016-12-08 23:08 537 查看
输入2个数(x,y)如果x等于y,则输出z=x+y,如果x大于y,则输出z=x-y,否则输出z=x+y

vi number2.sh

#!/bin/bash
#written by lizheng
#about panduan
echo "please enter two number"
read x
read y
if test $x -eq $y
then echo "z=$x - $y"
elif test $x -gt $y
then echo "z=$x -$y"
else echo "z=$x + $y"
fi






内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  比较 shell