用shell编程实现三个数的排序

来源:互联网 发布:python 网络爬虫代码 编辑:程序博客网 时间:2024/06/05 10:03

!/bin/bash

if [ $# -ne 3 ]; then
echo “Input error”
exit 1
fi

if [ 1gt2 ]; then
MAX=1MIN=2
else
MAX=2MIN=1
fi

if [ MAXlt3 ]; then
MAX=$3
fi

if [ MINgt3 ]; then
MIN=$3
fi

echo “max=MAX,min=MIN”

0 0
原创粉丝点击