数値の比較を行う
testコマンドを使う
#!/bin/sh #int_compare.sh a=3 b=5 c=3 if [ $a -lt $b ]; then echo "$a is less then $b" fi if [ $a -eq $c ]; then echo "$a is equal to $c" fi if [ $a -eq $b ]; then echo "$a is equal to $b" else echo "$a is NOT equal to $b" fi
$ ./int_comprare.sh 3 is less then 5 3 is equal to 3 3 is NOT equal to 5