/usr/bin/bash: Difference between revisions

Line 2,285: Line 2,285:


;<nowiki>local [option] [name[=value] ... | - ]</nowiki>
;<nowiki>local [option] [name[=value] ... | - ]</nowiki>
:For each argument, a local variable named name is created, and assigned value.  The option can  be  any of the options accepted by declare.  When local is used within a function, it causes the variable name to have a visible scope restricted to that function and its children.  If name is -, the set of shell options is made local to the function in which local is invoked: shell options changed using the set builtin inside the function  are  restored to  their  original values when the function returns.  The restore is effected as if a series of set commands were executed to restore the values that were  in  place  before  the function.  With  no operands, local writes a list of local variables to the standard output.  It is an error to use local when not within a function.  The return status is 0  unless local is used outside a function, an invalid name is supplied, or name is a readonly variable.
:各引数に対して、nameという名前のローカル変数が作成され、値が代入される。 オプションは、declareが受け付けるオプションのいずれかである。 localが関数内で使われると、変数名はその関数とその子関数に限定された可視スコープを持つようになる。 nameが-である場合、シェルオプションのセットは、localが呼び出された関数のローカルになる。関数内でset組み込み関数を使って変更されたシェルオプションは、関数が戻ったときに元の値に復元される。 このリストアは、あたかも一連のsetコマンドを実行して、関数を実行する前の値をリストアしたかのように行われる。 オペランドがない場合、localはローカル変数のリストを標準出力に書き出す。 関数内以外でlocalを使用するのはエラーである。 localが関数外で使用されているか、無効な名前が与えられているか、nameが読み取り専用変数でない限り、戻りステータスは0である。


;logout  
;logout  
:Exit a login shell.
:ログインシェルを終了する。


;<nowiki>mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]</nowiki>
;<nowiki>mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]</nowiki>
;<nowiki>readarray  [-d  delim]  [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]</nowiki>
;<nowiki>readarray  [-d  delim]  [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]</nowiki>
:Read lines from the standard input into the indexed array variable array, or from file descriptor fd if the -u option is supplied.  The variable MAPFILE is the default array.  Options, if supplied, have the following meanings:
:標準入力からインデックス付き配列変数arrayに、または-uオプションが与えられている場合はファイルディスクリプタfdから行を読み込む。 変数'''MAPFILE'''はデフォルトの配列である。 オプションが与えられた場合の意味は以下の通りである。:
:;-d
:;-d
::The first character of delim is used to terminate each input line, rather than newline.  If delim is the empty string, mapfile will terminate a line when it reads a NUL character.
::delimの最初の文字は、改行ではなく、各入力行を終了するために使われる。  delimが空文字列の場合、mapfileはNUL文字を読んだ時点で行を終了する。
:;-n
:;-n
::Copy at most count lines.  If count is 0, all lines are copied.
::最大で count 行コピーする。 countが0の場合、すべての行がコピーされる。
:;-O
:;-O
::Begin assigning to array at index origin.  The default index is 0.
::インデックスを原点として配列への代入を開始する。 デフォルトのインデックスは0である。
:;-s
:;-s
::Discard the first count lines read.
::最初に読んだカウント行は破棄する。
:;-t
:;-t
::Remove a trailing delim (default newline) from each line read.
::読み込んだ各行から末尾の区切り文字(デフォルトは改行)を取り除く。
:;-u
:;-u
::Read lines from file descriptor fd instead of the standard input.
::標準入力の代わりにファイル・ディスクリプタfdから行を読む。
:;-C
:;-C
::Evaluate callback each time quantum lines are read.  The -c option specifies  quantum.
::量子行が読み込まれるたびにコールバックを評価する。 -cオプションで量子を指定する。
:;-c
:;-c
::Specify the number of lines read between each call to callback.
::コールバックを呼び出すたびに読み込む行数を指定する。


:If  -C  is specified without -c, the default quantum is 5000.  When callback is evaluated, it is supplied the index of the next array element to be assigned and the line to  be  assigned  to  that element as additional arguments.  callback is evaluated after the line is read but before the array element is assigned.
:-cを指定せずに-Cを指定した場合、デフォルトの量子は5000である。 callbackが評価されるとき、追加引数として、次に代入される配列要素のインデックスと、その要素に代入される行が与えられる。


:If not supplied with an explicit origin, mapfile will clear array before assigning to it.
:明示的に原点が与えられない場合、mapfileはその原点に代入する前に配列をクリアする。


:mapfile returns successfully unless an invalid option or option argument is supplied,  array is invalid or unassignable, or if array is not an indexed array.
:mapfileは、無効なオプションやオプション引数が与えられていないか、配列が無効か割り当て不可能でないか、配列がインデックス付き配列でない場合を除き、正常に戻る。


;<nowiki>popd [-n] [+n] [-n]</nowiki>
;<nowiki>popd [-n] [+n] [-n]</nowiki>
:Removes  entries  from  the directory stack.  With no arguments, removes the top directory from the stack, and performs a cd to the new top directory.  Arguments, if supplied,  have the following meanings:
:ディレクトリスタックからエントリを削除する。 引数がない場合、スタックからトップディレクトリを削除し、新しいトップディレクトリへの cd を実行する。 引数が与えられた場合、以下の意味を持つ。:
:;-n
:;-n
::Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
::スタックからディレクトリを削除する際に、通常のディレクトリの変更を抑制し、スタックのみが操作されるようにする。
:;+n
:;+n
::Removes the nth entry counting from the left of the list shown  by  dirs,  starting with zero.  For example: ``popd +0'' removes the first directory, ``popd +1'' the second.
::dirs で示されるリストの左から 0 から数えて n 番目のエントリを削除する。 例えば: ``popd +0'' は最初のディレクトリを削除し、 ``popd +1'' は2番目のディレクトリを削除する。
:;-n
:;-n
::Removes the nth entry counting from the right of the list shown by  dirs,  starting with  zero.  For example: ``popd -0'' removes the last directory, ``popd -1'' the next to last.
::dirs で示されるリストの右から 0 から数えて n 番目のエントリを削除する。 例えば、 ``popd -0'' は最後のディレクトリを削除し、 ``popd -1'' はその次を削除する。


:If the popd command is successful, a dirs is performed as well, and the return  status  is 0.  popd returns false if an invalid option is encountered, the directory stack is empty, a non-existent directory stack entry is specified, or the directory change fails.
:popdコマンドが成功した場合、dirsも実行され、戻りステータスは0である。無効なオプションに遭遇した場合、ディレクトリスタックが空である場合、存在しないディレクトリスタックエントリが指定された場合、またはディレクトリの変更が失敗した場合、popdは偽を返す。


;<nowiki>printf [-v var] format [arguments]</nowiki>
;<nowiki>printf [-v var] format [arguments]</nowiki>