.\"O .SH PARAMETERS
.SH パラメータ
.\"O A
.\"O .I parameter
.\"O is an entity that stores values.
.\"O It can be a
.\"O .IR name ,
.\"O a number, or one of the special characters listed below under
.\"O .BR "Special Parameters" .
.\"O For the shell's purposes, a
.\"O .I variable
.\"O is a parameter denoted by a
.\"O .IR name .
.I パラメータ(parameter)
は値を保持するためのものです。パラメータには
.IR 名前 、
数字、後述の
.BR 特殊なパラメータ
で挙げる特殊文字のいずれかで表現されます。シェルの用法におい
ては、
.I 変数(variable)
とは
.IR 名前
で表現されたパラメータです。
.PP
.\"O A parameter is set if it has been assigned a value.  The null string is
.\"O a valid value.  Once a variable is set, it may be unset only by using
.\"O the
.\"O .B unset
.\"O builtin command (see
.\"O .SM
.\"O .B SHELL BUILTIN COMMANDS
.\"O below).
パラメータに値が代入されていれば、そのパラメータは設定されていると言わ
れます。空文字列も有効な値です。一度値を設定すると、組み込みコマンドの
.B unset
を使わなければ設定を取り消すことはできません(後述の
.SM
.B シェルの組み込みコマンド
を参照してください)。
.PP
.\"O A
.\"O .I variable
.\"O may be assigned to by a statement of the form
.I 変数
には、以下の形の構文で代入を行うことができます:
.RS
.PP
\fIname\fP=[\fIvalue\fP]
.RE
.PP
.\"O If
.\"O .I value
.\"O is not given, the variable is assigned the null string.  All
.\"O .I values
.\"O undergo tilde expansion, parameter and variable expansion,
.\"O command substitution, arithmetic expansion, and quote
.\"O removal (see
.\"O .SM
.\"O .B EXPANSION
.\"O below).  If the variable has its
.\"O .B integer
.\"O attribute set (see
.\"O .B declare
.\"O below in
.\"O .SM
.\"O .BR "SHELL BUILTIN COMMANDS" )
.\"O then
.\"O .I value
.\"O is subject to arithmetic expansion even if the $((...)) expansion is
.\"O not used (see
.\"O .B "Arithmetic Expansion"
.\"O below).
.I value
が与えられなかった場合、変数には空文字列が代入されます。全ての
.I value
に対して、チルダ展開、パラメータと変数の展開、コマンド置換、
算術式展開、クォート除去が行われます(後述の
.B 展開
を参照)。変数の
.B 整数
属性が設定されている場合(後述の
.BR シェルの組み込みコマンド
を参照)、$((...)) の展開を使っていなくても
.I value
に対しての算術展開が行われます(後述の
.B 算術式展開
を参照)。
.\"O Word splitting is not performed, with the exception
.\"O of \fB"$@"\fP as explained below under
.\"O .BR "Special Parameters" .
.\"O Pathname expansion is not performed.
.BR 特殊パラメータ
で後述する \fB"$@"\fP という例外を除いて、単語の分割は行われません。
パス名展開も実行されません。
.\"O .SS Positional Parameters
.SS 位置パラメータ(Positional Parameters)
.PP
.\"O A
.\"O .I positional parameter
.\"O is a parameter denoted by one or more
.\"O digits, other than the single digit 0.  Positional parameters are
.\"O assigned from the shell's arguments when it is invoked,
.\"O and may be reassigned using the
.\"O .B set
.\"O builtin command.  Positional parameters may not be assigned to
.\"O with assignment statements.  The positional parameters are
.\"O temporarily replaced when a shell function is executed (see
.\"O .SM
.\"O .B FUNCTIONS
.\"O below).
.I 位置パラメータ(positional parameter)
は、1 桁以上の数値で表されるパラメータです。ただし、0 は含みません。
位置パラメータは、シェルが起動されたときにシェルの引き数が代入されますが、
組み込みコマンドの
.B set
を使って代入し直すこともできます。代入文を使って位置パラメータへの
代入を行うことはできません。シェル関数が実行されると、位置パラメータ
は一時的に置き換えられます(後述の
.SM
.B 関数
を参照)。
.PP
.\"O When a positional parameter consisting of more than a single
.\"O digit is expanded, it must be enclosed in braces (see
.\"O .SM
.\"O .B EXPANSION
.\"O below).
2 桁以上の数値を含む位置パラメータを展開するときには、ブレース({})
で囲まなければなりません(後述の
.SM
.B 展開
を参照)。
.\"O .SS Special Parameters
.SS 特殊パラメータ
.PP
.\"O The shell treats several parameters specially.  These parameters may
.\"O only be referenced; assignment to them is not allowed.
シェルはいくつかのパラメータを特別扱いします。このようなパラメータは参
照されるだけであり、値を代入をすることは許されません。
.PD 0
.TP
.B *
.\"O Expands to the positional parameters, starting from one.  When the
.\"O expansion occurs within double quotes, it expands to a single word
.\"O with the value of each parameter separated by the first character
.\"O of the 
.\"O .SM
.\"O .B IFS
.\"O special variable.  That is, "\fB$*\fP" is equivalent
.\"O to "\fB$1\fP\fIc\fP\fB$2\fP\fIc\fP\fB...\fP", where
.\"O .I c
.\"O is the first character of the value of the
.\"O .SM
.\"O .B IFS
.\"O variable.  If
.\"O .SM
.\"O .B IFS
.\"O is unset, the parameters are separated by spaces.
1 から始めて全ての位置パラメータに展開されます。ダブルクォートの内
部で展開が行われたときは、それぞれのパラメータを
特別な変数である
.SM
.B IFS
の最初の文字で区切って並べた 1 つの単語に展開されます。つまり、
"\fB$*\fP" は "\fB$1\fP\fIc\fP\fB$2\fP\fIc\fP\fB...\fP" と同じです。こ
こで
.I c
は変数
.SM
.B IFS
の値の最初の文字です。
.SM
.B IFS
が設定されていなければ、パラメータは空白で区切られます。
.\"O If
.\"O .SM
.\"O .B IFS
.\"O is null, the parameters are joined without intervening separators.
.SM
.B IFS
が空文字列の場合、パラメータの間には区切り文字は入らず、
全てのパラメータは繋げられます。
.TP
.B @
.\"O Expands to the positional parameters, starting from one.  When the
.\"O expansion occurs within double quotes, each parameter expands to a
.\"O separate word.  That is, "\fB$@\fP" is equivalent to
.\"O "\fB$1\fP" "\fB$2\fP" ...
.\"O When there are no positional parameters, "\fB$@\fP" and 
.\"O .B $@
.\"O expand to nothing (i.e., they are removed).
1 から始めて全ての位置パラメータに展開されます。ダブルクォートの内
部で展開が行われたときは、それぞれのパラメータは別々の単語に展開されま
す。つまり "\fB$@\fP" は "\fB$1\fP" "\fB$2\fP" ... と同じです。位置付
きパラメータが無い場合には、"\fB$@\fP" と
.B $@
を展開しても空文字列になります(つまり取り除かれます)。
.TP
.B #
.\"O Expands to the number of positional parameters in decimal.
位置付きパラメータの個数を示す 10 進値に展開されます。
.TP
.B ?
.\"O Expands to the status of the most recently executed foreground
.\"O pipeline.
最後に実行されたフォアグラウンドのパイプラインの終了ステータスに展開さ
れます。
.TP
.B \-
.\"O Expands to the current option flags as specified upon invocation, 
.\"O by the
.\"O .B set
.\"O builtin command, or those set by the shell itself
.\"O (such as the
.\"O .B \-i
.\"O option).
現在のオプションフラグに展開されます。これは起動の時に指定したり、組み
込みコマンド
.B set
で設定したり、(
.B \-i
オプション等で)シェルそのものが設定したりします。
.TP
.B $
.\"O Expands to the process ID of the shell.  In a () subshell, it
.\"O expands to the process ID of the current shell, not the
.\"O subshell.
シェルのプロセス ID に展開されます。() を使ったサブシェルの内部では、$
はサブシェルではなく、現在のシェルのプロセス ID に展開されます。
.TP
.B !
.\"O Expands to the process ID of the most recently executed background
.\"O (asynchronous) command.
最後に実行されたバックグラウンド(非同期)コマンドのプロセス ID に展
開されます。
.TP
.B 0
.\"O Expands to the name of the shell or shell script.  This is set at
.\"O shell initialization.  If
.\"O .B bash
.\"O is invoked with a file of commands,
.\"O .B $0
.\"O is set to the name of that file.  If
.\"O .B bash
.\"O is started with the
.\"O .B \-c
.\"O option, then
.\"O .B $0
.\"O is set to the first argument after the string to be
.\"O executed, if one is present.  Otherwise, it is set
.\"O to the file name used to invoke
.\"O .BR bash ,
.\"O as given by argument zero.
シェルまたはシェルスクリプトの名前に展開されます。これはシェルの初期化
時に設定されます。コマンドを記述したファイルを指定して
.B bash
を起動した場合、
.B $0
にはそのファイルの名前が設定されます。
.B \-c
オプションを付けて
.B bash
を起動した場合、実行する文字列の後に引き数があれば、その最初の値が
.B $0
に設定されます。このオプションを指定していない場合には、
.BR bash
を起動する時に使用した名前が引き数 0 として与えられ 
.B $0
に設定されます。
.TP
.B _
.\"O At shell startup, set to the absolute file name of the shell or shell
.\"O script being executed as passed in the argument list.
.\"O Subsequently, expands to the last argument to the previous command,
.\"O after expansion.
.\"O Also set to the full file name of each command executed and placed in
.\"O the environment exported to that command.
.\"O When checking mail, this parameter holds the name of the mail file
.\"O currently being checked.
シェルの起動時には、引き数リストで渡された、実行するシェルまたはシェル
スクリプトの絶対ファイル名が設定されます。その後は、前のコマンドに対す
る最後の引き数(展開後のもの)に展開されます。また、実行する各コマンド
の完全なファイル名が設定され、そのコマンドへ環境変数としてエクスポート
されます。メールをチェックするときには、このパラメータは現在チェック
しているメールのファイル名を保持します。
.PD
.\"O .SS Shell Variables
.SS シェル変数
.PP
.\"O The following variables are set by the shell:
以下の変数はシェルが設定します:
.PP
.PD 0
.TP
.B PPID
.\"O The process ID of the shell's parent.  This variable is readonly.
そのシェルの親のプロセス ID。この変数は読み込み専用です。
.TP
.B PWD
.\"O The current working directory as set by the
.\"O .B cd
.\"O command.
.B cd
コマンドで設定された現在の作業ディレクトリ。
.TP
.B OLDPWD
.\"O The previous working directory as set by the
.\"O .B cd
.\"O command.
.B cd
コマンドで設定された、1 つ前の作業ディレクトリ。
.TP
.B REPLY
.\"O Set to the line of input read by the
.\"O .B read
.\"O builtin command when no arguments are supplied.
組み込みコマンド
.B read
に引き数が与えられなかった時に
読み込まれた行が設定されます。
.TP
.B UID
.\"O Expands to the user ID of the current user, initialized at shell startup.
.\"O This variable is readonly.
現在のユーザのユーザ ID に展開されます。初期化はシェルの起動時に行われ
ます。この変数は読み込み専用です。
.TP
.B EUID
.\"O Expands to the effective user ID of the current user, initialized at
.\"O shell startup.  This variable is readonly.
現在のユーザの実効ユーザ ID に展開されます。初期化はシェルの起動時に行
われます。この変数は読み込み専用です。
.TP
.B GROUPS
.\"O An array variable containing the list of groups of which the current
.\"O user is a member.
現在のユーザがメンバーになっているグループのリストを含んだ配列変数です。
.\"O Assignments to    
.\"O .SM
.\"O .B GROUPS
.\"O have no effect and are silently discarded.
.SM
.B GROUPS
への代入は効果がなく黙って捨てられます。
.\"O If
.\"O .SM
.\"O .B GROUPS
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B GROUPS
が unset された場合はこの変数の特殊な性質はなくなります。
その後に再設定されたとしても元に戻りません。
.TP
.B BASH
.\"O Expands to the full file name used to invoke this instance of
.\"O .BR bash .
現在実行している
.BR bash
を起動したときに使われた、完全なファイル名に展開されます。
.TP
.B BASH_VERSION
.\"O Expands to a string describing the version of this instance of
.\"O .BR bash .
現在実行している
.BR bash
のバージョンを示す文字列に展開されます。
.TP
.B BASH_VERSINFO
.\"O A readonly array variable whose members hold version information for
.\"O this instance of
.\"O .BR bash .
.\"O The values assigned to the array members are as follows:
読み込み専用の配列変数で、配列の各要素は現在実行されている
.BR bash
のバージョン情報を持っています。配列変数の要素に代入される内容を以下に
示します:
.sp .5
.RS
.PD 0
.TP 24
.B BASH_VERSINFO[\fR0\fP]
.\"O The major version number (the \fIrelease\fP).
メジャーバージョン番号(\fIリリース\fP)。
.TP
.B BASH_VERSINFO[\fR1\fP]
.\"O The minor version number (the \fIversion\fP).
マイナーバージョン番号(\fIバージョン\fP)。
.TP
.B BASH_VERSINFO[\fR2\fP]
.\"O The patch level.
パッチレベル。
.TP
.B BASH_VERSINFO[\fR3\fP]
.\"O The build version.
構築バージョン。
.TP
.B BASH_VERSINFO[\fR4\fP]
.\"O The release status (e.g., \fIbeta1\fP).
リリースステータス(\fIbeta1\fP など)。
.TP
.B BASH_VERSINFO[\fR5\fP]
.\"O The value of \fBMACHTYPE\fP.
\fBMACHTYPE\fP の値。
.PD
.RE
.TP
.B SHLVL
.\"O Incremented by one each time an instance of
.\"O .B bash
.\"O is started.
.B bash
の実体が起動されるたびに 1 ずつ増えます。
.TP
.B RANDOM
.\"O Each time this parameter is referenced, a random integer between
.\"O 0 and 32767 is
.\"O generated.  The sequence of random numbers may be initialized by assigning
.\"O a value to
.\"O .SM
.\"O .BR RANDOM .
.\"O If
.\"O .SM
.\"O .B RANDOM
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
このパラメータが参照される度に、0 から 32767 までのランダムな整数が生
成されます。
.SM
.BR RANDOM
に値を代入することにより、乱数の列を初期化することができます。
.SM
.B RANDOM
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B SECONDS
.\"O Each time this parameter is
.\"O referenced, the number of seconds since shell invocation is returned.  If a
.\"O value is assigned to 
.\"O .SM
.\"O .BR SECONDS ,
.\"O the value returned upon subsequent
.\"O references is
.\"O the number of seconds since the assignment plus the value assigned.
このパラメータを参照すると、シェルが起動されてからの秒数が返されます。
.SM
.BR SECONDS
に値を代入した場合、それ以降の参照において返される値は、代入された値と
代入以降の秒数を足した値になります。
.\"O If
.\"O .SM
.\"O .B SECONDS
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B SECONDS
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B LINENO
.\"O Each time this parameter is referenced, the shell substitutes
.\"O a decimal number representing the current sequential line number
.\"O (starting with 1) within a script or function.  When not in a
.\"O script or function, the value substituted is not guaranteed to
.\"O be meaningful.
この変数が参照されると、シェルは、スクリプトや関数における現在の行番号
(1から始まります)を表す 10 進値を代入します。スクリプトや関数の内部で
ない場合には、意味のある値が代入されることは保証されません。
.\"O If
.\"O .SM
.\"O .B LINENO
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B LINENO
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B HISTCMD
.\"O The history number, or index in the history list, of the current
.\"O command.
現在のコマンドの履歴番号(履歴リストにおけるインデックス)です。
.\"O If
.\"O .SM
.\"O .B HISTCMD
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B HISTCMD
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B FUNCNAME
.\"O The name of any currently-executing shell function.
.\"O This variable exists only when a shell function is executing.
現在実行中のシェル関数の名前です。
この変数はシェル関数を実行している間のみ存在します。
.\"O Assignments to
.\"O .SM
.\"O .B FUNCNAME
.\"O have no effect and are silently discarded.
.SM
.B FUNCNAME
へ代入は効果がなく黙って捨てられます。
.\"O If
.\"O .SM
.\"O .B FUNCNAME
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B FUNCNAME
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B DIRSTACK
.\"O An array variable (see
.\"O .B Arrays
.\"O below) containing the current contents of the directory stack.
.\"O Directories appear in the stack in the order they are displayed by the
.\"O .B dirs
.\"O builtin.
現在のディレクトリスタックの内容を持つ配列変数(後述の
.B 配列
を参照)です。組み込みコマンド
.B dirs
を使うと、スタック中のディレクトリがスタック順に表示されます。
.\"O Assigning to members of this array variable may be used to modify
.\"O directories already in the stack, but the
.\"O .B pushd
.\"O and
.\"O .B popd
.\"O builtins must be used to add and remove directories.
配列変数の要素に代入を行うことで、既にスタックに入っているディレクトリ
を変更することができますが、ディレクトリの追加と削除を行うためには、組
み込みコマンドの
.B pushd
と
.B popd
を使わなければなりません。
.\"O Assignment to this variable will not change the current directory.
この変数に代入を行っても現在の作業ディレクトリは変わりません。
.\"O If
.\"O .SM
.\"O .B DIRSTACK
.\"O is unset, it loses its special properties, even if it is
.\"O subsequently reset.
.SM
.B DIRSTACK
を
.B unset
すると、この変数の特殊な性質は無くなります。後で再び
.B set
しても元には戻りません。
.TP
.B PIPESTATUS
.\"O An array variable (see
.\"O .B Arrays
.\"O below) containing a list of exit status values from the processes
.\"O in the most-recently-executed foreground pipeline (which may
.\"O contain only a single command).
フォアグラウンドのパイプラインで最後に実行されたプロセスの
終了ステータスのリストを含む配列変数です(後述の
.B 配列
を参照)。
.TP
.B OPTARG
.\"O The value of the last option argument processed by the
.\"O .B getopts
.\"O builtin command (see
.\"O .SM
.\"O .B SHELL BUILTIN COMMANDS
.\"O below).
組み込みコマンド
.B getopts
で処理した最後のオプション引き数の値です(後述の
.SM
.B シェルの組み込みコマンド
を参照)。
.TP
.B OPTIND
.\"O The index of the next argument to be processed by the
.\"O .B getopts
.\"O builtin command (see
.\"O .SM
.\"O .B SHELL BUILTIN COMMANDS
.\"O below).
組み込みコマンド
.B getopts
で次に処理されるオプション引き数のインデックスです(後述の
.SM
.B シェルの組み込みコマンド
を参照)。
.TP
.B HOSTNAME
.\"O Automatically set to the name of the current host.
現在のホスト名が自動的に設定されます。
.TP
.B HOSTTYPE
.\"O Automatically set to a string that uniquely
.\"O describes the type of machine on which
.\"O .B bash
.\"O is executing.
.\"O The default is system-dependent.
.B bash
を実行するマシンの種類をユニークに記述する文字列が自動的に設定されます。
デフォルト値はシステム依存です。
.TP
.B OSTYPE
.\"O Automatically set to a string that
.\"O describes the operating system on which
.\"O .B bash
.\"O is executing.
.\"O The default is system-dependent.
.B bash
を実行するオペレーティングシステムを記述する文字列が自動的に設定されま
す。デフォルト値はシステム依存です。
.TP
.B MACHTYPE
.\"O Automatically set to a string that fully describes the system
.\"O type on which
.\"O .B bash
.\"O is executing, in the standard GNU \fIcpu-company-system\fP format.
.\"O The default is system-dependent.
.B bash
を実行するシステムの種類を完全に指定する文字列が、GNU 標準の
\fIcpu-company-system\fP の形式で設定されます。デフォルト値はシステム依
存です。
.TP
.B SHELLOPTS
.\"O A colon-separated list of enabled shell options.  Each word in
.\"O the list is a valid argument for the
.\"O .B \-o
.\"O option to the
.\"O .B set
.\"O builtin command (see
.\"O .SM
.\"O .B "SHELL BUILTIN COMMANDS"
.\"O below).  The options appearing in
.\"O .SM
.\"O .B SHELLOPTS
.\"O are those reported as
.\"O .I on
.\"O by \fBset \-o\fP.
コロン区切りのリストで、有効になっているシェルのオプションを示します。
リスト中のそれぞれの単語は、組み込みコマンド
.B set
の
.B \-o
オプション(後述の
.SM
.B シェルの組み込みコマンド
を参照)に対する有効な引き数になっています。
.SM
.B SHELLOPTS
に入っているオプションは、\fBset \-o\fP を実行した場合にも
.I on
であると報告されます。
.\"O If this variable is in the environment when
.\"O .B bash
.\"O starts up, each shell option in the list will be enabled before
.\"O reading any startup files.
.\"O This variable is read-only.
.B bash
の起動時に、この変数が環境変数に入っている場合、どの起動ファイルを読む
よりも前にリスト中のシェルオプションが有効になります。この変数は
読み込み専用です。
.TP
.B COMP_WORDS
.\"O An array variable (see \fBArrays\fP below) consisting of the individual
.\"O words in the current command line.
.\"O This variable is available only in shell functions invoked by the
.\"O programmable completion facilities (see \fBProgrammable Completion\fP
.\"O below).
現在のコマンドラインの各単語からなる配列変数(後述の \fB配列\fP 参照)です。
この変数はプログラム補完機能(後述の \fBプログラム補完\fP を参照)から呼ば
れたシェル関数においてのみ有効です。
.TP
.B COMP_CWORD
.\"O An index into \fB${COMP_WORDS}\fP of the word containing the current
.\"O cursor position.
.\"O This variable is available only in shell functions invoked by the
.\"O programmable completion facilities (see \fBProgrammable Completion\fP
.\"O below).
現在カーソルを含んでいる単語の \fB${COMP_WORDS}\fP における
インデックスです。
この変数はプログラム補完機能(後述の \fBプログラム補完\fP を参照)から呼ば
れたシェル関数においてのみ有効です。
.TP
.B COMP_LINE
.\"O The current command line.
.\"O This variable is available only in shell functions and external
.\"O commands invoked by the
.\"O programmable completion facilities (see \fBProgrammable Completion\fP
.\"O below).
現在のコマンドラインです。
この変数はプログラム補完機能(後述の \fBプログラム補完\fP を参照)から呼ば
れたシェル関数においてのみ有効です。
.TP
.B COMP_POINT
.\"O The index of the current cursor position relative to the beginning of
.\"O the current command.
.\"O If the current cursor position is at the end of the current command,
.\"O the value of this variable is equal to \fB${#COMP_LINE}\fP.
.\"O This variable is available only in shell functions and external
.\"O commands invoked by the
.\"O programmable completion facilities (see \fBProgrammable Completion\fP
.\"O below).
現在のコマンドの頭に対する相対的なカーソル位置のインデックスです。
現在のカーソル位置が現在の現在のコマンドの最後にある場合、
この変数の値は \fB${#COMP_LINE}\fP と等しくなります。
この変数はプログラム補完機能(後述の \fBプログラム補完\fP を参照)から呼ば
れたシェル関数においてのみ有効です。
.PD
.PP
.\"O The following variables are used by the shell.  In some cases,
.\"O .B bash
.\"O assigns a default value to a variable; these cases are noted
.\"O below.
以下の変数はシェルが使用します。場合によっては、
.B bash
がデフォルト値を変数に代入します。このような場合については後述します。
.PP
.PD 0
.TP
.B IFS
.\"O The
.\"O .I Internal Field Separator
.\"O that is used
.\"O for word splitting after expansion and to
.\"O split lines into words with the
.\"O .B read
.\"O builtin command.  The default value is
.\"O ``<space><tab><newline>''.
.I 内部フィールド区切り文字(Internal Field Separator)
であり、展開を行った後に単語を分割する場合や、組み込みコマンドの
.B read
を使った時に行を単語に分割する場合に使われます。
デフォルト値は ``<空白><タブ><改行>'' です。
.TP
.B PATH
.\"O The search path for commands.  It
.\"O is a colon-separated list of directories in which
.\"O the shell looks for commands (see
.\"O .SM
.\"O .B COMMAND EXECUTION
.\"O below).  The default path is system-dependent,
.\"O and is set by the administrator who installs
.\"O .BR bash .
.\"O A common value is ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''.
コマンドの検索パスです。シェルがコマンドを検索するディレクトリをコロン
で区切って並べたリストです(後述の
.SM
.B コマンドの実行
を参照)。デフォルトのパスはシステム依存で、
.BR bash
をインストールしたシステム管理者が設定します。
一般的な値は ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.'' です。
.TP
.B HOME
.\"O The home directory of the current user; the default argument for the
.\"O \fBcd\fP builtin command.
.\"O The value of this variable is also used when performing tilde expansion.
現在のユーザのホームディレクトリです。組み込みコマンド \fBcd\fP のデフォ
ルトの引き数になります。この変数の値は、チルダ展開を実行するときにも使
われます。
.TP
.B CDPATH
.\"O The search path for the
.\"O .B cd
.\"O command.
.\"O This is a colon-separated list of directories in which the shell looks
.\"O for destination directories specified by the
.\"O .B cd
.\"O command.
.\"O A sample value is ``.:~:/usr''.
.B cd
コマンドの検索パスです。これは、
.B cd
コマンドで指定した対象ディレクトリを探すディレクトリをコロンで区切って
並べたリストです。例えば、``.:~:/usr'' といった値になります。
.TP
.B BASH_ENV
.\"O If this parameter is set when \fBbash\fP is executing a shell script,
.\"O its value is interpreted as a filename containing commands to
.\"O initialize the shell, as in
.\"O .IR ~/.bashrc .
.\"O The value of
.\"O .SM
.\"O .B BASH_ENV
.\"O is subjected to parameter expansion, command substitution, and arithmetic
.\"O expansion before being interpreted as a file name.
.\"O .SM
.\"O .B PATH
.\"O is not used to search for the resultant file name.
\fBbash\fP がシェルスクリプトを実行する時にこの値が設定されている場合、
この値は(
.IR ~/.bashrc
のように)シェルを初期化するコマンドが書かれているファイル名と解釈され
ます。
.SM
.B BASH_ENV
の値をファイル名として処理する前には、パラメータ展開、コマンド置換、算
術的展開が行われます。
.SM
この結果のファイルを検索する際には
.B PATH
は使用されません。
.TP
.B MAIL
.\"O If this parameter is set to a file name and the
.\"O .SM
.\"O .B MAILPATH
.\"O variable is not set,
.\"O .B bash
.\"O informs the user of the arrival of mail in the specified file.
このパラメータにファイル名が設定されており、かつ変数
.SM
.B MAILPATH
が設定されていなければ、
.B bash
は指定されたファイルへのメールの到着をユーザに通知します。
.TP
.B MAILCHECK
.\"O Specifies how
.\"O often (in seconds)
.\"O .B bash
.\"O checks for mail.  The default is 60 seconds.  When it is time to check
.\"O for mail, the shell does so before displaying the primary prompt.
.\"O If this variable is unset, the shell disables mail checking.
.B bash
がメールをチェックする頻度を(秒数で)指定します。デフォルト値は 60 秒で
す。メールをチェックする時間になると、シェルはプライマリのプロンプトを
表示する前にチェックを行います。この変数が unset された場合、シェルは
メールのチェックを行いません。
.TP
.B MAILPATH
.\"O A colon-separated list of file names to be checked for mail. 
.\"O The message to be printed when mail arrives in a particular file
.\"O may be specified by separating the file name from the message with a `?'.
.\"O When used in the text of the message, \fB$_\fP expands to the name of
.\"O the current mailfile. 
メールのチェックに使うファイル名をコロンで区切って並べたリストです。特
定のファイルにメールが到着したときに出力されるメッセージは、`?' を使っ
てファイル名をメッセージから区切ることによって指定できます。メッセージ
のテキスト中で使われたときは、\fB$_\fP は現在のメールファイルの名前に
展開されます。
.\"O Example:
設定例:
.RS
.PP
\fBMAILPATH\fP='/var/mail/bfox?"You have mail":~/shell\-mail?"$_ has mail!"'
.PP
.\"O .B Bash
.\"O supplies a default value for this variable, but the location of the user
.\"O mail files that it uses is system dependent (e.g., /var/mail/\fB$USER\fP).
この変数のデフォルト値は
.B bash
が持っていますが、
.B bash
が使うユーザのメールファイルの位置はシステム依存です
(/var/mail/\fB$USER\fP 等)。
.RE
.TP
.B PS1
.\"O The value of this parameter is expanded (see
.\"O .SM
.\"O .B PROMPTING
.\"O below) and used as the primary prompt string.  The default value is
.\"O ``\fB\es\-\ev\e$ \fP''.
このパラメータの値は展開されてプライマリのプロンプト文字列として使われます。
(後述の
.SM
.B プロンプト
を参照)、
デフォルト値は ``\fB\es\-\ev\e$ \fP'' です。
.TP
.B PS2
.\"O The value of this parameter is expanded as with
.\"O .B PS1
.\"O and used as the secondary prompt string.  The default is
.\"O ``\fB> \fP''.
このパラメータの値は
.B PS1
と同じように展開され、セカンダリのプロンプト文字列として使われます。デ
フォルト値は ``\fB> \fP'' です。
.TP
.B PS3
.\"O The value of this parameter is used as the prompt for the
.\"O .B select
.\"O command (see
.\"O .SM
.\"O .B SHELL GRAMMAR
.\"O above).
このパラメータの値は
.B select
コマンド(前述の
.SM
.B シェルの文法
を参照)のプロンプトとして使われます。
.TP
.B PS4
.\"O The value of this parameter is expanded as with
.\"O .B PS1
.\"O and the value is printed before each command
.\"O .B bash
.\"O displays during an execution trace.  The first character of
.\"O .SM
.\"O .B PS4
.\"O is replicated multiple times, as necessary, to indicate multiple
.\"O levels of indirection.  The default is ``\fB+ \fP''.
このパラメータは
.B PS1
と同じように展開されます。この値は
実行トレース中に
.B bash
が表示する各コマンド前に出力されます。
複数段の間接レベルを示すときは、
.SM
.B PS4
の最初の文字が必要に応じて複数回表示されます。
デフォルト値は ``\fB+ \fP'' です。
.TP
.B TIMEFORMAT
.\"O The value of this parameter is used as a format string specifying
.\"O how the timing information for pipelines prefixed with the
.\"O .B time
.\"O reserved word should be displayed.
.\"O The \fB%\fP character introduces an escape sequence that is
.\"O expanded to a time value or other information.
.\"O The escape sequences and their meanings are as follows; the
.\"O braces denote optional portions.
このパラメータの値は、予約語である
.B time
が先頭に付いているパイプラインに対して、時間情報の表示の仕方を指定する
フォーマット文字列として使われます。\fB%\fP は、時間の値などに展開され
るエスケープシーケンスを示すための文字です。エスケープシーケンスとその
意味を以下に示します。ただし、ブレース([])は省略可能であることを表しま
す。
.sp .5
.RS
.PD 0
.TP 10
.B %%
.\"O A literal \fB%\fP.
\fB%\fP 文字そのもの。
.TP
.B %[\fIp\fP][l]R
.\"O The elapsed time in seconds.
経過した秒数。
.TP
.B %[\fIp\fP][l]U
.\"O The number of CPU seconds spent in user mode.
ユーザモードで使われた CPU の秒数。
.TP
.B %[\fIp\fP][l]S
.\"O The number of CPU seconds spent in system mode.
システムモードで使われた CPU の秒数。
.TP
.B %P
.\"O The CPU percentage, computed as (%U + %S) / %R.
CPU のパーセンテージ。(%U + %S) / %R で算出されます。
.PD
.RE
.IP
.\"O The optional \fIp\fP is a digit specifying the \fIprecision\fP,
.\"O the number of fractional digits after a decimal point.
.\"O A value of 0 causes no decimal point or fraction to be output.
.\"O At most three places after the decimal point may be specified;
.\"O values of \fIp\fP greater than 3 are changed to 3.
.\"O If \fIp\fP is not specified, the value 3 is used.
省略可能である \fIp\fP は、\fI精度(precision)\fPが何桁であるかを指定し
ます。つまり小数点以下の桁数を指定します。この値が 0 ならば、小数点や
小数の部分は出力されません。また、小数点以下で指定できるのは 3 桁まで
です。つまり、\fIp\fP の値が 3 より大きければ 3 に変更されます。
\fIp\fP を指定しなければ、この値は 3 となります。
.IP
.\"O The optional \fBl\fP specifies a longer format, including
.\"O minutes, of the form \fIMM\fPm\fISS\fP.\fIFF\fPs.
.\"O The value of \fIp\fP determines whether or not the fraction is
.\"O included.
省略可能である \fBl\fP を指定すると、分を含み、
\fIMM\fPm\fISS\fP.\fIFF\fP という形式の長いフォーマットになります。
小数を含むかどうかは \fIp\fP の値によって決まります。
.IP
.\"O If this variable is not set, \fBbash\fP acts as if it had the
.\"O value \fB$'\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS'\fP.
.\"O If the value is null, no timing information is displayed.
.\"O A trailing newline is added when the format string is displayed.
この変数が設定されていなければ、\fBbash\fP は
\fB$'\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS'\fP という値が指定されて
いるかのように動作します。この値が空文字列ならば、時間の情報は表示され
ません。フォーマット文字列の表示の際には、末尾に改行文字が追加されます。
.TP
.B HISTSIZE
.\"O The number of commands to remember in the command history (see
.\"O .SM
.\"O .B HISTORY
.\"O below).  The default value is 500.
コマンド履歴に記憶するコマンドの数(後述の
.SM
.B HISTORY
を参照)。
.TP
.B HISTFILE
.\"O The name of the file in which command history is saved (see
.\"O .SM
.\"O .B HISTORY
.\"O below).  The default value is \fI~/.bash_history\fP.  If unset, the
.\"O command history is not saved when an interactive shell exits.
コマンド履歴が保存されるファイルの名前(後述の
.SM
.B 履歴
を参照)。デフォルト値は \fI~/.bash_history\fP です。設定されていない場
合、対話シェルが終了する時に履歴の保存が行われません。
.TP
.B HISTFILESIZE
.\"O The maximum number of lines contained in the history file.  When this
.\"O variable is assigned a value, the history file is truncated, if
.\"O necessary, to contain no more than that number of lines.  The default
.\"O value is 500.  The history file is also truncated to this size after
.\"O writing it when an interactive shell exits.
履歴ファイルに保持する履歴の最大数です。この変数に値が代入された場合、
その行数を越えないように、必要に応じて履歴ファイルが切り詰められます。
デフォルト値は 500 です。対話シェルが終了する時にも、履歴ファイルのサ
イズはファイル書き込みの後にこのサイズに切り詰められます。
.TP
.B OPTERR
.\"O If set to the value 1,
.\"O .B bash
.\"O displays error messages generated by the
.\"O .B getopts
.\"O builtin command (see
.\"O .SM
.\"O .B SHELL BUILTIN COMMANDS
.\"O below).
.\"O .SM
.\"O .B OPTERR
.\"O is initialized to 1 each time the shell is invoked or a shell
.\"O script is executed.
値として 1 が設定されている場合、
.B bash
は組み込みコマンド
.B getopts
(後述の
.SM
.B シェルの組み込みコマンド
を参照)を使って生成したエラーメッセージを表示します。シェルが起動され
たり、シェルスクリプトが実行される度に、
.SM
.B OPTERR
は 1 に初期化されます。
.TP
.B LANG
.\"O Used to determine the locale category for any category not specifically
.\"O selected with a variable starting with \fBLC_\fP.
\fBLC_\fP で始まる変数で特に選択されない任意のカテゴリに対して、ロケー
ルのカテゴリを決めるために使います。
.TP
.B LC_ALL
.\"O This variable overrides the value of \fBLANG\fP and any other
.\"O \fBLC_\fP variable specifying a locale category.
この変数はロケールのカテゴリを指定する \fBLC_\fP 変数と \fBLANG\fP の
値を全て上書きします。
.TP
.B LC_COLLATE
.\"O This variable determines the collation order used when sorting the
.\"O results of pathname expansion, and determines the behavior of range
.\"O expressions, equivalence classes, and collating sequences within
.\"O pathname expansion and pattern matching.
.\"O 要チェック
この変数はパス名展開の結果をソートするときに使用される照合順序と
範囲展開、同値クラス、パス名展開とパターンマッチングにおける
照合シーケンスを決定します。
.TP
.B LC_CTYPE
.\"O This variable determines the interpretation of characters and the
.\"O behavior of character classes within pathname expansion and pattern
.\"O matching.
この変数は、パス名展開とパターンマッチングにおける文字の解釈と文字クラ
スの挙動を決めます。
.TP
.B LC_MESSAGES
.\"O This variable determines the locale used to translate double-quoted
.\"O strings preceded by a \fB$\fP.
この変数は、\fB$\fP の後に続くダブルクォートされた文字列の
翻訳に使うロケールを決めます。
.TP
.B LC_NUMERIC
.\"O This variable determines the locale category used for number formatting.
この変数は数字のフォーマットに使用するロケールカテゴリを決定します。
.TP
.B PROMPT_COMMAND
.\"O If set, the value is executed as a command prior to issuing each primary
.\"O prompt.
設定されていると、プライマリプロンプトを出す前に毎回、この値がコマンド
として実行されます。
.TP
.B IGNOREEOF
.\"O Controls the
.\"O action of an interactive shell on receipt of an
.\"O .SM
.\"O .B EOF
.\"O character as the sole input.  If set, the value is the number of
.\"O consecutive
.\"O .SM
.\"O .B EOF
.\"O characters which must be
.\"O typed as the first characters on an input line before
.\"O .B bash
.\"O exits.  If the variable exists but does not have a numeric value, or
.\"O has no value, the default value is 10.  If it does not exist,
.\"O .SM
.\"O .B EOF
.\"O signifies the end of input to the shell.
単独で入力された
.SM
.B EOF
文字を受け取ったときの対話シェルの動作を制御します。この変数が設定され
ていれば、指定されている値の数だけの
.SM
.B EOF
文字を連続して行頭の文字として入力しなければ
.B bash
は終了しません。この変数に数値以外の値が設定されている場合や、値が設定
されていない場合には、デフォルト値として 10 が使われます。この変数が存
在しなければ、
.SM
.B EOF
文字はシェルへの入力の終わりを示します。
.TP
.B TMOUT
.\"O If set to a value greater than zero, the value is interpreted as the
.\"O number of seconds to wait for input after issuing the primary prompt.
.\"O .B Bash
.\"O terminates after waiting for that number of seconds if input does
.\"O not arrive.
0 より大きい値が設定されていると、この値はプライマリプロンプトを出した
後に入力を待つ秒数として解釈されます。この秒数だけ待った時点で入力が無
ければ
.B bash
は終了します。
.TP
.B FCEDIT
.\"O The default editor for the
.\"O .B fc
.\"O builtin command.
組み込みコマンド
.B fc
が使うデフォルトのエディタです。
.TP
.B FIGNORE
.\"O A colon-separated list of suffixes to ignore when performing
.\"O filename completion (see
.\"O .SM
.\"O .B READLINE
.\"O below).
.\"O A filename whose suffix matches one of the entries in 
.\"O .SM
.\"O .B FIGNORE
.\"O is excluded from the list of matched filenames.
.\"O A sample value is ``.o:~''.
ファイル名補完(後述の
.SM
.B READLINE
を参照)を行う際に無視するサフィックスをコロンで区切って並べたリストで
す。
.SM
.B FIGNORE
のエントリのいずれかにサフィックスがマッチするファイル名は、ファイル名
補完にマッチするファイルのリストから除外されます。例えば値として 
``.o:~'' を設定します。
.TP
.B GLOBIGNORE
.\"O A colon-separated list of patterns defining the set of filenames to
.\"O be ignored by pathname expansion.
.\"O If a filename matched by a pathname expansion pattern also matches one
.\"O of the patterns in
.\"O .SM
.\"O .BR GLOBIGNORE ,
.\"O it is removed from the list of matches.
パス名展開で無視するファイル名の集合を定義するパターンをコロンで区切っ
て並べたリストです。パス名展開パターンにマッチするファイル名が
.SM
.BR GLOBIGNORE
内のパターンのどれかにもマッチする場合、これはマッチしたもののリストか
ら削除されます。
.TP
.B INPUTRC
.\"O The filename for the
.\"O .B readline
.\"O startup file, overriding the default of
.\"O .FN ~/.inputrc
.\"O (see
.\"O .SM
.\"O .B READLINE
.\"O below).
.B readline
の起動ファイルのファイル名です。これはデフォルト値の
.FN ~/.inputrc
(後述の
.SM
.B READLINE
を参照)を上書きします。
.TP
.B HISTCONTROL
.\"O If set to a value of
.\"O .IR ignorespace ,
.\"O lines which begin with a
.\"O .B space
.\"O character are not entered on the history list.
.\"O If set to a value of
.\"O .IR ignoredups ,
.\"O lines matching the last history line are not entered.
.IR ignorespace
の値が設定されていると、
.B 空白
文字で始まる行は履歴リストに入りません。
.IR ignoredups
の値が設定されていると、履歴の最後の行にマッチする行は履歴リストに入り
ません。
.\"O A value of
.\"O .I ignoreboth
.\"O combines the two options.
.I ignoreboth
の値はこれらの 2 つのオプションを同時に実現します。
.\"O If unset, or if set to any other value than those above,
.\"O all lines read
.\"O by the parser are saved on the history list, subject to the value
.\"O of
.\"O .BR HISTIGNORE .
設定されていないか上記のいずれの値でもない場合には、パーザが読み込ん
だ全ての行は
.BR HISTIGNORE
の値が示す条件の下で履歴リストに保存されます。
.\"O This variable's function is superseded by
.\"O .BR HISTIGNORE .
この変数は既に古くなっており、この機能は
.BR HISTIGNORE
変数で用いることになっています。
.\"O The second and subsequent lines of a multi-line compound command are
.\"O not tested, and are added to the history regardless of the value of
.\"O .BR HISTCONTROL .
複数行にまたがる複雑なコマンドの場合は 2 番目以降の行が調べられること
はありません。よって、これらは
.BR HISTCONTROL
の値に関わらず履歴に追加されます。
.TP
.B HISTIGNORE
.\"O A colon-separated list of patterns used to decide which command lines
.\"O should be saved on the history list.  Each pattern is anchored at the
.\"O beginning of the line and must match the complete line (no implicit
.\"O `\fB*\fP' is appended).  Each pattern is tested against the line
.\"O after the checks specified by
.\"O .B HISTCONTROL
.\"O are applied.
どのコマンド行を履歴リストに保存するかを決めるために使うパターンをコロ
ンで区切って並べたリストです。それぞれのパターンは行の先頭と比較され
行全体が完全に一致しなければなりません(`\fB*\fP' が暗黙的に追加されるこ
とはありません)。各パターンの評価は
.B HISTCONTROL
で指定したチェックが行われた後の行に対して実行されます。
.\"O In addition to the normal shell pattern matching characters, `\fB&\fP'
.\"O matches the previous history line.  `\fB&\fP' may be escaped using a
.\"O backslash; the backslash is removed before attempting a match.
.\"O The second and subsequent lines of a multi-line compound command are
.\"O not tested, and are added to the history regardless of the value of
.\"O .BR HISTIGNORE .
通常のシェルのパターンマッチング文字以外に、`\fB&\fP' が履歴の前の行
にマッチします。バックスラッシュを使って `\fB&\fP' をエスケープするこ
とができます。マッチングを試みる前にバックスラッシュは取り除かれます。
複数行にまたがる複雑なコマンドの場合、2 番目以降の行は調べられません。
よって、これらは
.BR HISTIGNORE
の値に関わらず履歴に追加されます。
.TP
.B histchars
.\"O The two or three characters which control history expansion
.\"O and tokenization (see
.\"O .SM
.\"O .B HISTORY EXPANSION
.\"O below).  The first character is the \fIhistory expansion\fP character,
.\"O the character which signals the start of a history
.\"O expansion, normally `\fB!\fP'.
2 文字または 3 文字で、
履歴の展開とトークン分割(後述の
.SM
.B 履歴展開
を参照)を制御します。最初の文字は \fI履歴展開(history expansion)\fP 文字
であり、履歴展開の先頭を示す文字です。通常、これは `\fB!\fP' です。
.\"O The second character is the \fIquick substitution\fP
.\"O character, which is used as shorthand for re-running the previous
.\"O command entered, substituting one string for another in the command.
.\"O The default is `\fB^\fP'.
2 番目の文字は \fI簡易置換(quick substitution)\fP
文字であり、前に入力したコマンドの
文字列を別の文字列に置き換えて再実行を行うための省略表現として使います。
デフォルト値は `\fB^\fP' です。
.\"O The optional third character is the character
.\"O which indicates that the remainder of the line is a comment when found
.\"O as the first character of a word, normally `\fB#\fP'.  The history
.\"O comment character causes history substitution to be skipped for the
.\"O remaining words on the line.  It does not necessarily cause the shell
.\"O parser to treat the rest of the line as a comment.
3 番目の文字は省略可能です。単語の先頭でこの文字が見つかると行の残りの
部分がコメントとなるような文字を指定します。これは通常は `\fB#\fP' で
す。履歴コメント文字があると、その行の残りの単語に対する履歴置換はスキッ
プされます。この文字があるからといって、必ずしもシェルのパーザが行の残
りの部分をコメントとして扱うわけではありません。
.TP
.B HOSTFILE
.\"O Contains the name of a file in the same format as
.\"O .FN /etc/hosts
.\"O that should be read when the shell needs to complete a
.\"O hostname.
.FN /etc/hosts
と同じフォーマットであり、シェルがホスト名を補完する必要があるときに読
み込むファイルの名前を示します。
.\"O The list of possible hostname completions may be changed while the
.\"O shell is running;
シェルの実行中でも補完するホスト名のリストを変更することができます。
.\"O the next time hostname completion is attempted after the
.\"O value is changed,
.\"O .B bash
.\"O adds the contents of the new file to the existing list.
次にホスト名の補完を試みるとき、
.B bash
は新しいファイルの内容を既存のデータベースに追加します。
.\"O If
.\"O .SM
.\"O .B HOSTFILE
.\"O is set, but has no value, \fBbash\fP attempts to read
.\"O .FN /etc/hosts
.\"O to obtain the list of possible hostname completions.
.SM
.B HOSTFILE
が設定されているがその値が空文字列の場合、\fBbash\fP は
補完可能なホスト名のリストを取得するために
.FN /etc/hosts
を使用します。
.\"O When
.\"O .SM
.\"O .B HOSTFILE
.\"O is unset, the hostname list is cleared.
.SM
.B HOSTFILE
が unset された場合は、ホスト名のリストはクリアされます。
.TP
.B auto_resume
.\"O This variable controls how the shell interacts with the user and
.\"O job control.  If this variable is set, single word simple
.\"O commands without redirections are treated as candidates for resumption
.\"O of an existing stopped job.  There is no ambiguity allowed; if there is
.\"O more than one job beginning with the string typed, the job most recently
.\"O accessed is selected.  The
.\"O .I name
.\"O of a stopped job, in this context, is the command line used to
.\"O start it.
この変数はシェルがユーザとジョブ制御の相互作用をどのように扱うかを
決めます。この変数を設定した場合、1 語からなるリダイレクト無しの
単純なコマンドは、停止中のジョブが存在していると、それを実行を再開する
候補として扱います。曖昧な指定は許されません。入力された文字列で始めら
れたジョブが複数ある場合には、最後にアクセスしたものが選ばれます。
この文脈における
.I 名前
とは、コマンドを起動する際に使ったコマンドラインのことです。
.\"O If set to the value
.\"O .IR exact ,
.\"O the string supplied must match the name of a stopped job exactly;
.\"O if set to
.\"O .IR substring ,
.\"O the string supplied needs to match a substring of the name of a
.\"O stopped job.  The
.\"O .I substring
.\"O value provides functionality analogous to the
.\"O .B %?
.\"O job identifier (see
.\"O .SM
.\"O .B JOB CONTROL
.\"O below).  If set to any other value, the supplied string must
.\"O be a prefix of a stopped job's name; this provides functionality
.\"O analogous to the
.\"O .B %
.\"O job identifier.
この値に
.IR exact
が設定されている場合、与えられた文字列は停止しているジョブの名前に正確
にマッチしなければなりません。
.IR substring
が設定されている場合は、与えられた文字列は停止しているジョブの名前の部
分文字列にマッチする必要があります。
.I substring
という値は、ジョブ識別子の
.B %?
に似た機能を持っています(後述の
.SM
.B ジョブ制御
を参照)。これ以外の値が設定されている場合、与えられた文字列は停止して
いるジョブの名前のプレフィックスでなければなりません。これはジョブ識別
子の
.B %
と似た機能を持っています。
.TP
.B COMPREPLY
.\"O An array variable from which \fBbash\fP reads the possible completions
.\"O generated by a shell function invoked by the programmable completion
.\"O facility (see \fBProgrammable Completion\fP below).
\fBbash\fP が可能な補完候補を読み込む配列変数です。
この値はプログラム補完機能(後述の \fBプログラム補完\fP を参照)
によって呼び出されたシェル関数によって生成されます。
.PD
.\"O .SS Arrays
.SS 配列
.\"O .B Bash
.\"O provides one-dimensional array variables.  Any variable may be used as
.\"O an array; the
.\"O .B declare
.\"O builtin will explicitly declare an array.  There is no maximum
.\"O limit on the size of an array, nor any requirement that members
.\"O be indexed or assigned contiguously.  Arrays are indexed using
.\"O integers and are zero-based.
.B bash
は 1 次元の配列変数を扱うことができます。全ての変数は配列として使用できます。
.B declare
組み込みコマンドで明示的に配列を宣言できます。
配列のサイズの上限はありませんし、メンバの連続的なインデックス付け
や代入をしなければならないという条件もありません。
配列のインデックス付けは 0 をから始まる整数を用いて行います。
.PP
.\"O An array is created automatically if any variable is assigned to using
.\"O the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP.  The
.\"O .I subscript
.\"O is treated as an arithmetic expression that must evaluate to a number
.\"O greater than or equal to zero.  To explicitly declare an array, use
.\"O .B declare \-a \fIname\fP
.\"O (see
.\"O .SM
.\"O .B SHELL BUILTIN COMMANDS
.\"O below).
変数の代入の際に \fIname\fP[\fIsubscript\fP]=\fIvalue\fP という記法が
使われた場合、配列は自動的に生成されます。
.I subscript
は算術式として扱われますが、この式は評価すると 0 以上の数値になるもの
でなければなりません。明示的に配列を宣言するには、
.B declare \-a \fIname\fP
を使います(後述の
.SM
.B シェルの組み込みコマンド
を参照)。
.\"O .B declare \-a \fIname\fP[\fIsubscript\fP]
.\"O is also accepted; the \fIsubscript\fP is ignored.  Attributes may be
.\"O specified for an array variable using the
.\"O .B declare
.\"O and
.\"O .B readonly
.\"O builtins.  Each attribute applies to all members of an array.
.B declare \-a \fIname\fP[\fIsubscript\fP]
も許されます。\fIsubscript\fP は無視されます。
組み込みコマンドの
.B declare
と
.B readonly
を使い、配列変数に対して属性を設定することができます。どちらの属性も配
列のメンバ全てに対して適用されます。
.PP
.\"O Arrays are assigned to using compound assignments of the form
.\"O \fIname\fP=\fB(\fPvalue\fI1\fP ... value\fIn\fP\fB)\fP, where each
.\"O \fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP.  Only
.\"O \fIstring\fP is required.  If
.\"O the optional brackets and subscript are supplied, that index is assigned to;
.\"O otherwise the index of the element assigned is the last index assigned
.\"O to by the statement plus one.  Indexing starts at zero.
配列の代入は
\fIname\fP=\fB(\fPvalue\fI1\fP ... value\fIn\fP\fB)\fP という形式の
複合代入(compound assignment)を用いて行います。ここで、それぞれの
\fIvalue\fP の形式は [\fIsubscript\fP]=\fIstring\fP です。必要なのは
\fIstring\fP だけです。ブラケット([])と添字を省略しなかった場合、その
インデックスに対して代入が行われます。省略した場合には、代入される要素
のインデックスは、その文の中で直前に代入されたインデックスに 1 を加え
たものになります。インデックスは 0 から始まります。
.\"O This syntax is also accepted by the
.\"O .B declare
.\"O builtin.  Individual array elements may be assigned to using the
.\"O \fIname\fP[\fIsubscript\fP]=\fIvalue\fP syntax introduced above.
この記法は組み込みコマンド
.B declare
でも使うことができます。個別の配列要素に対する代入は、先に説明した
\fIname\fP[\fIsubscript\fP]=\fIvalue\fP の記法を使って行うことができます。
.PP
.\"O Any element of an array may be referenced using
.\"O ${\fIname\fP[\fIsubscript\fP]}.  The braces are required to avoid
.\"O conflicts with pathname expansion.  If
.\"O \fIsubscript\fP is \fB@\fP or \fB*\fP, the word expands to
.\"O all members of \fIname\fP.  These subscripts differ only when the
.\"O word appears within double quotes.  If the word is double-quoted,
.\"O ${\fIname\fP[*]} expands to a single
.\"O word with the value of each array member separated by the first
.\"O character of the
.\"O .SM
.\"O .B IFS
.\"O special variable, and ${\fIname\fP[@]} expands each element of
.\"O \fIname\fP to a separate word.  When there are no array members,
.\"O ${\fIname\fP[@]} expands to nothing.  This is analogous to the expansion
.\"O of the special parameters \fB*\fP and \fB@\fP (see
.\"O .B Special Parameters
.\"O above).  ${#\fIname\fP[\fIsubscript\fP]} expands to the length of
.\"O ${\fIname\fP[\fIsubscript\fP]}.  If \fIsubscript\fP is \fB*\fP or
.\"O \fB@\fP, the expansion is the number of elements in the array.
.\"O Referencing an array variable without a subscript is equivalent to
.\"O referencing element zero.
配列の任意の要素は、${\fIname\fP[\fIsubscript\fP]} を使って参照するこ
とができます。パス名展開との衝突を避けるためにブレースが必要です。
\fI添字(subscript)\fPが \fB@\fP か \fB*\fP ならば、その単語は
\fIname\fP の全ての要素に展開されます。これらの添字が異なるのは、単語
がダブルクォートの内部にある場合だけです。単語がダブルクォートされてい
れば、${\fIname\fP[*]} は 1 つの単語に展開されます。この単語は、配列の
各メンバの値を特殊変数
.SM
.B IFS
の値で区切って並べたものです。${\fIname\fP[@]}は、\fIname\fP の各要素
を別々の単語に展開します。配列のメンバが全く無いときは、${\fIname\fP[@]}
は空の単語に展開されます。これは特殊パラメータ \fB*\fP や \fB@\fP に似
ています(前述の
.B 特殊パラメータ
を参照)。${#\fIname\fP[\fIsubscript\fP]} は
${\fIname\fP[\fIsubscript\fP]} の長さに展開されます。\fIsubscript\fP
が \fB*\fP または \fB@\fP の場合は、配列中の要素数に展開されます。添字
無しでの配列変数の参照は、要素 0 を参照することと同じです。
.PP
.\"O The
.\"O .B unset
.\"O builtin is used to destroy arrays.  \fBunset\fP \fIname\fP[\fIsubscript\fP]
.\"O destroys the array element at index \fIsubscript\fP.
.\"O \fBunset\fP \fIname\fP, where \fIname\fP is an array, or
.\"O \fBunset\fP \fIname\fP[\fIsubscript\fP], where
.\"O \fIsubscript\fP is \fB*\fP or \fB@\fP, removes the entire array.
組み込みコマンドの
.B unset
は配列の破棄に使われます。\fBunset\fP \fIname\fP[\fIsubscript\fP] によ
り、インデックスが \fIsubscript\fP である配列の要素が破棄されます。
\fBunset\fP \fIname\fP(\fIname\fP は配列)または
\fBunset\fP \fIname\fP[\fIsubscript\fP](\fIsubscript\fP が \fB*\fP ま
たは \fB@\fP)で、配列全体が破棄されます。
.PP
.\"O The
.\"O .BR declare ,
.\"O .BR local ,
.\"O and
.\"O .B readonly
.\"O builtins each accept a
.\"O .B \-a
.\"O option to specify an array.  The
.\"O .B read
.\"O builtin accepts a
.\"O .B \-a
.\"O option to assign a list of words read from the standard input
.\"O to an array.  The
.\"O .B set
.\"O and
.\"O .B declare
.\"O builtins display array values in a way that allows them to be
.\"O reused as assignments.
組み込みコマンドの
.BR declare ,
.BR local ,
.B readonly
いずれにおいても、
.B \-a
オプションで配列を指定することができます。組み込みコマンド
.B read
では
.B \-a
オプションを使って、標準入力から読み込んだ単語のリストを配列に代入する
ことができます。組み込みコマンド
.B set
と
.B declare
では、代入で再利用できるような形で配列の値を表示します。
