最終更新:2013-07-23 (火) 13:42:06 (3902d)
test
Top / test
ファイル形式のチェックや値の比較を行う
Bash/組み込みコマンド
オプション 例 意味 -eq test num1 -eq num2 num1 と num2 が等しければ真となる。 -ne test num1 -ne num2 num1 と num2 が等しくなければ真となる。 -lt test num1 -lt num2 num1 が num2 より小ならば真となる。 -le test num1 -le num2 num1 が num2 以下ならば真となる。 -gt test num1 -gt num2 num1 が num2 より大ならば真となる。 -ge test num1 -ge num2 num1 が num2 以上ならば真となる。 = test 文字列1 = 文字列2 != test 文字列1 = 文字列2 -nt test file1 -nt file2 file1がfile2より新しいと真 -ot test file1 -ot file2 file1がfile2より古いと真 -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 が実行可能ならば真となる。 -a test 論理式1 -a 論理式2 AND -a test 論理式1 -o 論理式2 OR