test
他の質問への答えからとは異なる[
バイナリであることがわかりましたが、[
マンページではtest
エンディングが必要なこと以外に何か]
他の点はありますか?そうでなければ、なぜシンボリックリンクではなく別々のバイナリですか? (またbash
内蔵されており、bash
違いはありません。)
ベストアンサー1
これソースコード--help
オプションの処理方法の違いを説明してください。
/* Recognize --help or --version, but only when invoked in the "[" form, when the last argument is not "]". Use direct parsing, rather than parse_long_options, to avoid accepting abbreviations. POSIX allows "[ --help" and "[ --version" to have the usual GNU behavior, but it requires "test --help" and "test --version" to exit silently with status 0. */
デモ
$ /usr/bin/test --help
$
$ /usr/bin/[ --help
Usage: test EXPRESSION
or: test
or: [ EXPRESSION ]
or: [ ]
or: [ OPTION
Exit with the status determined by EXPRESSION.
[...]
bash
内蔵バージョンでは、あなたが言ったように最後になければならない点だけが[
異なります。]