
Unix系のオペレーティングシステムにおいて、 true (トゥルー)とは常に終了コード0を返すだけのコマンドである。 Unix systems for operating in, true (True) is a command that just returns an exit code always 0. シェルによって論理値の真と解釈される。 Shell by the logic value of true is interpreted. 普通はシェルスクリプトの条件文やループにおいて利用される。 Normally the shell script of conditionals and loops are available in. このとき、 ブーリアン型の値はプログラムの終了コードとして与えられる。 In this case, Boolean values are given as the end of the program code. 例えば、以下のBourne shellスクリプトは割り込みを受けるまで文字列helloを表示する: For example, the following Bourne shell script text until it receives an interrupt hello to view:
while true while true do do echo hello echo hello done done
このプログラムは実際の引数を取らないが、あるバージョンでは、標準パラメータ--helpが使用法の要約を表示し、 --versionがプログラムのバージョンを表示する。 This program is the "real" that takes no arguments, in one version, the standard parameter --help Display the usage summary, --version displays the version of the program.
trueは単独のコロン( : )としても書くことができる。 true single colon ( : ) can be written as. この形式は、一般的にシェルの組み込みコマンドであり、そのためにいっそう重要である。 This format is typically a shell builtin commands are more important for that. 上記の例をtrueの代わりに:を使用して書くこともできる: The above examples true instead : you can write using:
while : while: do do echo hello echo hello done done
別名の:の形式では、 trueは通常は( Bourne shellのようなPOSIX互換のシェルにおいて)ダミーのコマンドとして使用できる。 Alias : in the form of, true is usually ( Bourne Shell , such as POSIX compatible shell at) can be used as a dummy command. ダミーのコマンドとしては、 ${parameter:=word}の形式でパラメータに値を代入する。 As a dummy command, ${parameter:=word} that assigns values to the parameters of the form. [1]例えば、 bashのためのバグ・レポート・スクリプトである bashbug では以下のように使われる: [1] For example, bash script, bug reports for the following bashbug used in:
${TMPDIR:=/tmp} $ {TMPDIR: = / tmp} ${EDITOR=$DEFEDITOR} $ {EDITOR = $ DEFEDITOR} ${USER=${LOGNAME-`whoami`} } $ {USER = $ {LOGNAME-`whoami`}}
true は実行ファイルとして提供されるが、シェルによっては組み込み版が提供されている。 The true executable file will be provided as have been provided by the shell built-in version.
| ||||||||||||||||||||||||||
