#!/bin/bash# author:keke
value1=10
value2=20
if test $[value1]-eq $[value2]
then
echo"value1 = value2"
elif test $[value1]-gt $[value2]
then
echo"value1 < value2"elseecho"value1 < value2"
fi
#Output
value1 < value2
String Test
parameter
description
=
if "=" ; true
!=
if "!=" ;true
-z
if string length is zero ; true
-n
if string length is not zero ; true
#!/bin/bash# author:keke
string1="kekememory"
string2="kekememor"if test $string1 = $string2
then
echo"string1 = string2"elseecho"string1 != string2"
fi
#Output
string1 != string2
File Test
parameter
description
-e
if file exits ; true
-r
if file exists && only-read ;true
-w
if file exists && write-available ; true
-x
if file exists && excuate-available ; true
-s
if file exists && more than a string ; true
-d
if file exists && is directory ; true
-f
if file exists && normal file ; true
-c
if file exists && char-type file ; true
-b
if file exists && block-type file ; true
#!/bin/bash# author:keke
cd /bin
if test -e ./bash
then
echo"File exists!"elseecho"No existied file~"
fi
#!/bin/bash# author:keke
cd /bin
if test -e ./sys
then
echo"File exists!"elseecho"No existied file~"
fi