码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本练习(12.8)

时间:2016-12-09 08:51:22      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:shell 比较

输入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脚本练习(12.8)

标签:shell 比较

原文地址:http://11937277.blog.51cto.com/11927277/1880963

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!