2013/08/07

bash test option

・-eq → equal
・-ne → not equal
・-lt → less than
・-le → less than or equal
・-gt → greater than
・-ge → greater than or equal



-z     test -z string     string の文字列長が 0 ならば真となる。
-n     test -n string     string の文字列長が 0 より大ならば真となる。
-d     test -d file     file がディレクトリならば真となる。
-f     test -f file     file が普通のファイルならば真となる。
-s     test -s file     file が 0 より大きいサイズならば真となる。
-e     test -e file     file が存在するならば真となる。
-r     test -r file     file が読み取り可能ならば真となる。
-w     test -w file     file が書き込み可能ならば真となる。
-x     test -x file     file が実行可能ならば真となる。