A,B : 対象
X,Y : 条件文
S,T,U : 処理
うさげ
[ X ] && S : if X then S
[ X ] || S : if not X then S
if [ X ]
then
S
elif [ Y ]
then
T
else
U
fi
while [ X ]
do
S
done
until [ X ]
do
S
done
数値
[ A -eq B ] : A Equal B
[ A -ne B ] : A Not Equal B
[ A -gt B ] : A Greater Than B
[ A -ge B ] : A Greater or Equal B
[ A -lt B ] : A Less Than B
[ A -le B ] : A Less or Equal B
文字
[ A ] [ -n A ] : number of characters > 0
[ ! A ] [ -z A ] : number of characters = 0
ファイル
[ -d A ] : A is Directory
[ -f A ] : A is File
[ -L A ] : A is Link
[ -r A ] : A is Readable
[ -w A ] : A is Writable
[ -x A ] : A is eXecutable
[ -s A ] : Size of A > 0
[ A -nt B ] : A is Newer Than B
[ A -ot B ] : A is Older Than B
○○かつ××,○○または××
[ X -a Y ] : X = 0 and Y = 0
[ X -o Y ] : X = 0 or Y = 0
最終更新:2010年04月21日 15:01