编写shell脚本,实现如下功能:(1)从命令行读入2个整数;(2)对两个数进行大小比较;(3)在屏幕上输出

编写shell脚本,实现如下功能:(1)从命令行读入2个整数;(2)对两个数进行大小比较;(3)在屏幕上输出比较结果。 三个都要做出来!!

第1个回答  2011-10-24
#!/bin/bash
echo 1
read i
echo 2
read j

if [ $i -eq $j ]
then
echo "equal"
exit
fi

if [ $i -lt $j ]
then
echo "max $j"
else
echo "mix$i"
fi
相似回答