最終更新:2024-12-17 (火) 12:52:55 (205d)
test
Top / test
ファイル形式のチェックや値の比較を行う
- test -n?
Bash/組み込みコマンド
オプション 例 意味 test -eq? test num1 -eq num2 num1 と num2 が等しければ真となる。 test -ne? test num1 -ne num2 num1 と num2 が等しくなければ真となる。 test -lt? test num1 -lt num2 num1 が num2 より小ならば真となる。 test -le? test num1 -le num2 num1 が num2 以下ならば真となる。 test -gt? test num1 -gt num2 num1 が num2 より大ならば真となる。 test -ge? test num1 -ge num2 num1 が num2 以上ならば真となる。 test =? test 文字列1 = 文字列2 test !=? test 文字列1 != 文字列2 test -nt? test file1 -nt file2 file1がfile2より新しいと真 test -ot? test file1 -ot file2 file1がfile2より古いと真 test -z? test -z string string の文字列長が 0 ならば真となる。 test -n? test -n string string の文字列長が 0 より大ならば真となる。 test -d? test -d file file がディレクトリならば真となる。 test -f? test -f file file が普通のファイルならば真となる。 test -s? test -s file file が 0 より大きいサイズならば真となる。 test -e? test -e file file が存在するならば真となる。 test -r? test -r file file が読み取り可能ならば真となる。 test -w? test -w file file が書き込み可能ならば真となる。 test -x? test -x file file が実行可能ならば真となる。 test -a? test 論理式1 -a 論理式2 AND test oa? test 論理式1 -o 論理式2 OR