#!/bin/bash
if [ $# -ne 3 ];then
echo "Usage: ./compare.sh ARG1 ARG2 ARG3"
exit 1
fi
if [ $1 -gt $2 ];then
if [ $1 -gt $3 ];then
if [ $2 -gt $3 ];then
echo "$1 > $2 > $3"
else
echo "$1 > $3 > $2"
fi
else
echo "$3 > $1 > $2"
fi
elif [ $2 -gt $3 ];then
if [ $1 -gt $3 ];then
echo "$2 > $1 > $3"
else
echo "$2 > $3 > $1"
fi
else
echo "$3 > $2 > $1"
fi
原文:http://sharewaytogo.blog.51cto.com/2816479/1846531