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

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

相关推荐