红联Linux门户
Linux帮助

Linux下从命令行下读入两个数字并比较大小

发布时间:2015-02-04 10:41:55来源:linux网站作者:zhifeiyu2008

Linux下从命令行下读入两个数字并比较大小相关代码:


#!/bin/bash
echo "Please input number a:"
read a
echo "Please input number b:"
read b
if [ "$a" -eq "$b" ]
then  echo "$a equals $b"
elif [ "$a" -gt "$b" ]
then  echo "$a is greater than $b"
else
echo "$a is less than $b"
fi