/usr/bin/bash: Difference between revisions

Line 2,397: Line 2,397:
;<nowiki>set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]</nowiki>
;<nowiki>set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]</nowiki>
;<nowiki>set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]</nowiki>
;<nowiki>set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]</nowiki>
:Without options, the name and value of each shell variable are displayed in a format  that can  be  reused  as input for setting or resetting the currently-set variables.  Read-only variables cannot be reset.  In posix mode, only shell variables are listed.  The output is sorted  according  to  the  current locale.  When options are specified, they set or unset shell attributes.  Any arguments remaining after option processing are treated  as  values for the positional parameters and are assigned, in order, to $1, $2, ... $n.  Options, if specified, have the following meanings:
:オプションがなければ、各シェル変数の名前と値が、現在設定されている変数を設定またはリセットするための入力として再利用できる形式で表示される。 読み取り専用の変数はリセットできない。 posix モードでは、シェル変数のみが一覧表示される。 出力は、現在のロケールに従ってソートされる。 オプションが指定されると、シェル属性を設定または解除する。 オプション処理後に残った引数は、位置パラメータの値として扱われ、 $1, $2, ... $n の順に代入される。 オプションが指定された場合、以下の意味を持つ:
:;-a
:;-a
::Each variable or function that is created or modified is given the  export  attribute and marked for export to the environment of subsequent commands.
::作成または変更された各変数や関数にはexport属性が与えられ、後続のコマンドの環境にエクスポートされるようにマークされる。
:;-b
:;-b
::Report  the  status  of terminated background jobs immediately, rather than before the next primary prompt.  This is effective only when job control is enabled.
::終了したバックグラウンドジョブのステータスを、次のプライマリプロンプトの前ではなく、直ちに報告する。 これは、ジョブ制御が有効な場合にのみ有効である。
:;-e
:;-e
::Exit immediately if a pipeline (which may consist of a single simple  command),  a list,  or a compound command (see SHELL GRAMMAR above), exits with a non-zero status.  The shell does not exit if the command that fails is  part  of  the  command list  immediately  following  a while or until keyword, part of the test following the if or elif reserved words, part of any command executed in a && or || list except  the  command following the final && or ||, any command in a pipeline but the last, or if the command's return value is being inverted with !.   If  a  compound command  other  than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit.  A trap on ERR,  if  set,  is executed before the shell exits.  This option applies to the shell environment and each subshell environment separately (see COMMAND EXECUTION ENVIRONMENT above), and may cause subshells to exit before executing all the commands in the subshell.
::パイプライン(単一の単純なコマンドで構成される)、リスト、または複合コマンド(上記の [[#SHELL GRAMMAR|SHELL GRAMMAR ]]を参照)がゼロ以外のステータスで終了した場合、直ちに終了する。 失敗したコマンドが、whileまたはuntilキーワードの直後のコマンドリストの一部、ifまたはelif予約語に続くテストの一部、最後の&&または||に続くコマンドを除く&&または||リストで実行されるコマンドの一部、パイプラインの最後のコマンド以外のコマンド、コマンドの戻り値がeが無視されている間にコマンドが失敗したため、サブシェル以外の複合コマンドがゼロ以外のステータスを返した場合、シェルは終了しない。 ERRのトラップが設定されている場合は、シェルが終了する前に実行される。 このオプションは、シェル環境と各サブシェル環境に個別に適用され (上記の「 [[#COMMAND EXECUTION ENVIRONMENT|COMMAND EXECUTION ENVIRONMENT ]]」を参照)、サブシェル内のすべてのコマンドを実行する前にサブシェルが終了することがある。


::If  a  compound  command or shell function executes in a context where -e is being ignored, none of the commands executed within the  compound  command  or  function body will be affected by the -e setting, even if -e is set and a command returns a failure status.  If a compound command or shell function sets -e  while  executing in  a context where -e is ignored, that setting will not have any effect until the compound command or the command containing the function call completes.
::-eが無視されるコンテキストで複合コマンドまたはシェル関数が実行される場合、-eが設定されているコマンドで失敗ステータスが返されたとしても、複合コマンドまたは関数本体内で実行されるコマンドはいずれも-e設定の影響を受けない。 -eが無視されるコンテキストで実行中に複合コマンドまたはシェル関数が-eを設定した場合、複合コマンドまたは関数呼び出しを含むコマンドが完了するまで、その設定は影響を及ぼさない。
:;-f
:;-f
::Disable pathname expansion.
::Disable pathname expansion.
:;-h
:;-h
::Remember the location of commands as they are looked up for execution.  This  is enabled by default.
::コマンドを実行するために検索する際に、コマンドの場所を記憶する。 これはデフォルトで有効になっている。
:;-k
:;-k
::All  arguments  in the form of assignment statements are placed in the environment for a command, not just those that precede the command name.
::コマンド名の前にある引数だけでなく、代入文の形をしたすべての引数がコマンドの環境に置かれる。
:;-m
:;-m
::Monitor mode.  Job control is enabled.  This option is on by default for  interactive shells on systems that support it (see JOB CONTROL above).  All processes run in a separate process group.  When a background job completes, the shell prints  a line containing its exit status.
::モニターモード。 ジョブ制御が有効になっている。 このオプションは、対話型シェルをサポートしているシステムではデフォルトでオンになっている(上記の [[#JOB CONTROL|JOB CONTROL ]]を参照)。 すべてのプロセスは別々のプロセスグループで実行される。 バックグラウンド・ジョブが完了すると、シェルは終了ステータスを含む行を表示する。
:;-n
:;-n
::Read  commands  but do not execute them.  This may be used to check a shell script for syntax errors.  This is ignored by interactive shells.
::コマンドを読むが実行はしない。 これは、シェルスクリプトの構文エラーをチェックするために使用される。 対話型シェルでは無視される。
:;-o option-name
:;-o option-name
::The option-name can be one of the following:
::オプション名は以下のいずれかである:
::allexport
::allexport
:::Same as -a.
:::-aと同じ
::braceexpand
::braceexpand
:::Same as -B.
:::-Bと同じ
::emacs
::emacs
:::Use an emacs-style command line editing interface.  This is enabled by de‐
:::emacsスタイルのコマンドライン編集インターフェイスを使用する。 これはデフォルトで有効になっている。ただし、 --noeditingオプションを指定してシェルを起動した場合はこの限りではない。 これは、read -eで使用される編集インターフェースにも影響する。
::fault 
:::when the shell is interactive, unless the shell is started with the --noediting option.  This also affects the editing interface used for read -e.
::errexit  
::errexit  
:::Same as -e.
:::-eと同じ
::errtrace
::errtrace
:::Same as -E.
:::-Eと同じ
::functrace
::functrace
:::Same as -T.
:::-Tと同じ
::hashall  
::hashall  
:::Same as -h.
:::-hと同じ
::histexpand
::histexpand
:::Same as -H.
:::-Hと同じ
::history  
::history  
:::Enable  command history, as described above under HISTORY.  This option is on by default in interactive shells.
:::上記の「 [[#HISTORY|HISTORY ]]」で説明したように、コマンドヒストリーを有効にする。 このオプションは対話型シェルではデフォルトでオンになっている。
::ignoreeof
::ignoreeof
:::The effect is as if the shell command ``IGNOREEOF=10'' had  been  executed (see Shell Variables above).
:::あたかもシェルコマンド ``IGNOREEOF=10'' が実行されたかのような効果がある(上記のシェル変数を参照)
::keyword
::keyword
:::Same as -k.
:::-kと同じ
::monitor
::monitor
:::Same as -m.
:::-mと同じ
::noclobber
::noclobber
:::Same as -C.
:::-Cと同じ
::noexec
::noexec
:::Same as -n.
:::-nと同じ
::noglob
::noglob
:::Same as -f.
:::-fと同じ
::nolog
::nolog
:::Currently ignored.
:::現在は無視されている。
::notify   
::notify   
:::Same as -b.
:::-bと同じ
::nounset  
::nounset  
:::Same as -u.
:::-uと同じ
::onecmd   
::onecmd   
:::Same as -t.
:::-tと同じ
::physical
::physical
:::Same as -P.
:::-Pと同じ
::pipefail
::pipefail
:::If  set,  the  return value of a pipeline is the value of the last (right‐most) command to exit with a non-zero status, or zero if all  commands  in the pipeline exit successfully.  This option is disabled by default.
:::設定されている場合、パイプラインの戻り値は、0以外のステータスで終了した最後の(最も右側の)コマンドの値、またはパイプライン内のすべてのコマンドが正常に終了した場合は0になる。 このオプションはデフォルトでは無効になっている。
::posix
::posix
:::Change  the  behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).  See SEE ALSO below for a  reference  to a document that details how posix mode affects bash's behavior.
:::デフォルトの動作がPOSIX標準と異なるbashの動作を、標準に合わせるように変更する(posixモード)。 posixモードがbashの動作にどのような影響を与えるかを詳しく説明したドキュメントへのリファレンスは、以下のSEE ALSOを参照のこと。
::privileged
::privileged
:::Same as -p.
:::-pと同じ
::verbose  
::verbose  
:::Same as -v.
:::-vと同じ
::vi
::vi
:::Use a vi-style command line editing  interface.  This  also  affects the editing interface used for read -e.
:::Viスタイルのコマンドライン編集インターフェイスを使用する。 これは、read -eで使用される編集インターフェースにも影響する。
::xtrace   
::xtrace   
:::Same as -x.
:::Same as -x.
::If  -o is  supplied  with  no  option-name, the values of the current options are printed.  If +o is supplied with no option-name,  a  series  of  set commands  to recreate the current option settings is displayed on the standard output.
::option-name なしで -o を指定すると、現在のオプションの値が表示される。 option-name なしで +o を指定すると、現在のオプション設定を再現する一連の set コマンドが標準出力に表示される。
:;-p
:;-p
::Turn  on privileged mode.  In this mode, the $ENV and $BASH_ENV files are not processed, shell functions are not inherited from the environment, and the SHELLOPTS, BASHOPTS, CDPATH, and GLOBIGNORE variables, if they appear in the environment, are ignored.  If the shell is started with the effective user (group) id not equal  to the  real  user  (group)  id, and the -p option is not supplied, these actions are taken and the effective user id is set to the real user id.  If the -p  option  is supplied  at startup, the effective user id is not reset.  Turning this option off causes the effective user and group ids to be set to the real user and group ids.
::特権モードをオンにする。 このモードでは、$ENV $BASH_ENV ファイルは処理されず、シェル関数は環境から継承されず、 SHELLOPTS、BASHOPTS、CDPATH、GLOBIGNORE 変数が環境にある場合は無視される。 実効ユーザー(グループ)IDが実ユーザー(グループ)IDに等しくない状態でシェルが起動され、-pオプションが与えられなかった場合、これらのアクションが実行され、実効ユーザーIDが実ユーザーIDに設定される。 起動時に-pオプションが指定された場合、実効ユーザーIDはリセットされない。 このオプションをオフにすると、実効ユーザーIDとグループIDが実際のユーザーIDとグループIDに設定される。
:;-t
:;-t
::Exit after reading and executing one command.
::コマンドを1つ読んで実行したら終了する。
:;-u
:;-u
::Treat unset variables and parameters other than the special parameters "@" and "*" as  an error when performing parameter expansion.  If expansion is attempted on an unset variable or parameter, the shell prints an error message, and, if not interactive, exits with a non-zero status.
::特殊パラメータ "@" "*" 以外の未設定の変数とパラメータを、パラメータ展開の際にエラーとして扱う。 未設定の変数やパラメータを展開しようとした場合、シェルはエラーメッセージを表示し、対話的でない場合は0以外のステータスで終了する。
:;-v
:;-v
::Print shell input lines as they are read.
::シェルの入力行が読み込まれると、それを表示する。
:;-x
:;-x
::After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
::各単純コマンド、forコマンド、caseコマンド、selectコマンド、または算術コマンドを展開した後、PS4の展開値を表示し、その後にコマンドとその展開された引数、または関連する単語リストを表示する。
:;-B
:;-B
::The shell performs brace expansion (see Brace Expansion above).  This is on by default.
::シェルはブレース展開を行う(上記のブレース展開を参照)。 これはデフォルトでオンになっている。
:;-C
:;-C
::If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators.  This may be overridden when creating output files by using the redirection operator >| instead of >.
::設定すると、bashは既存のファイルを>>&<>リダイレクト演算子で上書きしない。 この設定は、出力ファイルを作成するときに > の代わりに >| というリダイレクト演算子を使うことで上書きすることができる。
:;-E
:;-E
::If set, any trap on ERR is inherited by shell  functions,  command  substitutions, and commands executed in a subshell environment.  The ERR trap is normally not inherited in such cases.
::設定されている場合、ERRのトラップはすべて、シェル関数、コマンド置換、サブシェル環境で実行されるコマンドに継承される。 このような場合、ERRトラップは通常継承されない。
:;-H
:;-H
::Enable !  style history substitution.  This option is on by default when the shell is interactive.
::スタイルの履歴置換を有効にする。 このオプションは、シェルが対話型の場合、デフォルトでオンになる。
:;-P
:;-P
::If set, the shell does not resolve symbolic links when executing commands such as cd that change the current working directory.  It  uses  the  physical  directory structure instead.  By default, bash follows the logical chain of directories when performing commands which change the current directory.
::設定されていると、カレント作業ディレクトリを変更するcdなどのコマンドを実行するときに、シェルはシンボリックリンクを解決しない。 代わりに物理的なディレクトリ構造を使用する。 デフォルトでは、カレント・ディレクトリを変更するコマンドを実行するとき、bashはディレクトリの論理的な連鎖に従う。
:;-T
:;-T
::If set, any traps on DEBUG and RETURN are inherited by  shell  functions,  command substitutions, and commands executed in a subshell environment.  The DEBUG and RETURN traps are normally not inherited in such cases.
::設定されている場合、DEBUGとRETURNのトラップは、シェル関数、コマンド置換、サブシェル環境で実行されるコマンドに継承される。 DEBUGとRETURNのトラップは通常、このような場合には継承されない。
:;--
:;--
::If no arguments follow this option, then  the  positional  parameters  are  unset.Otherwise, the positional parameters are set to the args, even if some of them begin with a -.
::このオプションの後に引数が続かない場合、位置パラメーターは設定されない。そうでない場合、位置パラメーターは引数に設定され、たとえ引数の一部が-で始まるとしても、位置パラメーターは引数に設定される。
:;-
:;-
::Signal the end of options, cause all remaining args to be assigned to  the  positional  parameters.  The -x and -v options are turned off.  If there are no args, the positional parameters remain unchanged.
::オプションの終了を合図し、残りのすべての引数を位置パラメーターに代入させる。 xと-vオプションはオフになる。 引数がない場合、位置パラメーターは変更されない。


:特に断りのない限り、オプションはデフォルトでオフになっている。 ではなく+を使用すると、これらのオプションはオフになる。 オプションは、シェルを起動する際の引数として指定することもできる。 現在のオプションのセットは $- にある。 無効なオプションに遭遇しない限り、戻り値は常に真である。
:特に断りのない限り、オプションはデフォルトでオフになっている。 ではなく+を使用すると、これらのオプションはオフになる。 オプションは、シェルを起動する際の引数として指定することもできる。 現在のオプションのセットは $- にある。 無効なオプションに遭遇しない限り、戻り値は常に真である。