Linux shell之if 用法#!/bin/bash #if用法 if [[ a -gt b ]] #如果a大于b,注意中括号和a之间有空格。 then #那么 echo "a > b" #输出这个内容 elif [[ a -lt b ]] #如果a 小于b then #那么 echo "a < b" #输出这个内容 else #如果以上两个都不是 echo " a = b" #输出这个内容 fi #结束 # a -eq b a=b # a -gt b a>b # a -ge b a>=b # a -lt b a<b # a -le b a<=b # a -ne b a!=b相关阅读:Linux Shell参数替换 http://www.linuxidc.com/Linux/2013-06/85356.htmShell for参数 http://www.linuxidc.com/Linux/2013-07/87335.htmLinux/Unix Shell 参数传递到SQL脚本 http://www.linuxidc.com/Linux/2013-03/80568.htmShell脚本中参数传递方法介绍 http://www.linuxidc.com/Linux/2012-08/69155.htmShell脚本传递命令行参数 http://www.linuxidc.com/Linux/2012-01/52192.htm