Linux shell之if 用法


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参数替换

Shell for参数

Linux/Unix Shell 参数传递到SQL脚本

Shell脚本中参数传递方法介绍

Shell脚本传递命令行参数

相关内容