|
|
(10 intermediate revisions by the same user not shown) |
Line 1,824: |
Line 1,824: |
|
| |
|
| == HISTORY == | | == HISTORY == |
| When the -o history option to the set builtin is enabled, the shell provides access to the command history, the list of commands previously typed. The value of the HISTSIZE variable is used as the number of commands to save in a history list. The text of the last HISTSIZE commands (default 500) is saved. The shell stores each command in the history list prior to parameter and variable expansion (see EXPANSION above) but after history expansion is performed, subject to the values of the shell variables HISTIGNORE and HISTCONTROL.
| | set 組み込み関数の -o history オプションを有効にすると、シェルはコマンド履歴(以前に入力したコマンドのリスト)にアクセスできるようになる。 '''HISTSIZE''' 変数の値は、履歴リストに保存するコマンドの数として使用される。 最後のHISTSIZEコマンド(デフォルト500)のテキストが保存される。 シェルは、パラメータと変数の拡張(上記のEXPANSIONを参照)の前に、ヒストリ拡張が実行された後に、シェル変数'''HISTIGNORE'''と'''HISTCONTROL'''の値に従って、各コマンドをヒストリリストに保存する。 |
|
| |
|
| On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history). The file named by the value of HISTFILE is truncated, if necessary, to contain no more than the number of lines specified by the value of HISTFILESIZE. If HISTFILESIZE is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history line. These timestamps are optionally displayed depending on the value of the HISTTIMEFORMAT variable.
| | 起動時に、履歴は変数'''HISTFILE'''で指定されたファイル(デフォルトは~/.bash_history)から初期化される。 '''HISTFILE'''の値で指定されたファイルは、必要に応じて'''HISTFILESIZE'''の値で指定された行数以下に切り詰められる。 '''HISTFILESIZE'''が未設定、またはNULL、非数値、0未満の数値に設定されている場合、 履歴ファイルは切り捨てられない。 ヒストリファイルが読み込まれると、ヒストリコメント文字の直後に数字が続く行は、次のヒストリ行のタイムスタンプとして解釈される。これらのタイムスタンプは、変数'''HISTTIMEFORMAT'''の値に応じてオプションで表示される。 |
| When a shell with history enabled exits, the last $HISTSIZE lines are copied from the history list to $HISTFILE. If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten. If HISTFILE is unset, or if the history file is unwritable, the history is not saved. If the HISTTIMEFORMAT variable is set, time stamps are written to the history file, marked with the history comment character, so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. After saving the history, the history file is truncated to contain no more than HISTFILESIZE lines. If HISTFILESIZE is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated.
| | 履歴を有効にしたシェルが終了すると、最後の $HISTSIZE 行が履歴リストから $HISTFILE にコピーされる。 histappend シェル・オプションが有効な場合 (以下の [[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]] の shopt の説明を参照のこと)、その行はヒストリ・ファイルに追加される。 HISTFILEが設定されていない場合、または履歴ファイルが書き込み不可能な場合、履歴は保存されない。 '''HISTTIMEFORMA'''T変数が設定されている場合、履歴ファイルにタイムスタンプが書き込まれ、履歴コメント文字でマークされる。 これは、タイムスタンプを他のヒストリ行と区別するためにヒストリコメント文字を使用する。 ヒストリを保存した後、ヒストリファイルは'''HISTFILESIZE'''行以下に切り詰められる。 '''HISTFILESIZE'''が設定されていないか、NULL、数値以外、または0未満の数値に設定されている場合、ヒストリファイルは切り捨てられない。 |
|
| |
|
| The builtin command fc (see SHELL BUILTIN COMMANDS below) may be used to list or edit and re-execute a portion of the history list. The history builtin may be used to display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list.
| | 組み込みコマンドfc(後述の「[[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]」を参照)を使用して、ヒストリリストの一部を一覧表示または編集して再実行することができる。 history組み込みコマンドは、履歴リストの表示や変更、履歴ファイルの操作に使用できる。 コマンドライン編集を使用する場合、各編集モードで履歴リストにアクセスできる検索コマンドが利用できる。 |
| The shell allows control over which commands are saved on the history list. The HISTCONTROL and HISTIGNORE variables may be set to cause the shell to save only a subset of the commands entered.
| | シェルでは、どのコマンドを履歴リストに保存するかを制御できる。 '''HISTCONTROL''' 変数と HISTIGNORE 変数を設定することで、入力されたコマンドの一部だけをシェルに保存させることができる。 |
| The cmdhist shell option, if enabled, causes the shell to attempt to save each line of a multiline command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The lithist shell option causes the shell to save the command with embedded newlines instead of semicolons. See the description of the shopt builtin below under SHELL BUILTIN COMMANDS for information on setting and unsetting shell options.
| | cmdhist シェル・オプションを有効にすると、シェルは複数行のコマンドの各行を同じ履歴エントリに保存しようとし、構文の正しさを保つために必要な場合はセミコロンを追加する。 lithist シェル・オプションは、セミコロンの代わりに改行を埋め込んでコマンドを保存するようにする。 シェル・オプションの設定と解除については、後述の「[[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]」の shopt 組み込みコマンドの説明を参照のこと。 |
|
| |
|
| == HISTORY EXPANSION == | | == HISTORY EXPANSION == |
| The shell supports a history expansion feature that is similar to the history expansion in csh.
| | シェルは、cshのヒストリ展開に似たヒストリ展開機能をサポートしている。 |
| This section describes what syntax features are available. This feature is enabled by default for interactive shells, and can be disabled using the +H option to the set builtin command (see SHELL BUILTIN COMMANDS below). Non-interactive shells do not perform history expansion by default.
| | このセクションでは、どのような構文機能が利用できるかを説明する。 この機能は対話型シェルではデフォルトで有効になっており、set builtin コマンドの +H オプションを使用して無効にすることができる(後述の「SHELL BUILTIN COMMANDS」を参照)。 非対話型シェルは、デフォルトではヒストリ展開を行わない。 |
|
| |
|
| History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly.
| | ヒストリ拡張は、ヒストリリストから単語を入力ストリームに導入し、コマンドを繰り返したり、前のコマンドの引数を現在の入力行に挿入したり、前のコマンドのエラーを素早く修正したりすることを容易にする。 |
|
| |
|
| History expansion is performed immediately after a complete line is read, before the shell breaks it into words, and is performed on each line individually without taking quoting on previous lines into account. It takes place in two parts. The first is to determine which line from the history list to use during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is the event, and the portions of that line that are acted upon are words. Various modifiers are available to manipulate the selected words. The line is broken into words in the same fashion as when reading input, so that several metacharacter-separated words surrounded by quotes are considered one word. History expansions are introduced by the appearance of the history expansion character, which is ! by default. Only backslash (\) and single quotes can quote the history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double-quoted string.
| | ヒストリ展開は、完全な行が読み込まれた直後、シェルがそれを単語に分割する前に実行され、前の行のクォートを考慮することなく、各行に対して個別に実行される。 これは2つの部分に分かれて行われる。 1つ目は、置換時に履歴リストからどの行を使用するかを決定することである。 もうひとつは、その行の一部を現在の行に含めるために選択することである。 履歴から選択された行がイベントであり、その行の一部が単語となる。 選択された単語を操作するために、さまざまな修飾子が利用できる。 行は入力を読むときと同じ方法で単語に分割され、引用符で囲まれたメタ文字で区切られた複数の単語は1つの単語とみなされる。 ヒストリ拡張は、ヒストリ拡張文字(デフォルトでは! ヒストリ展開文字を引用符で囲むことができるのは、バックスラッシュ( \ )と一重引用符だけであるが、二重引用符で囲んだ文字列の閉じ二重引用符の直前にヒストリ展開文字がある場合も、引用符で囲んだものとして扱われる。 |
|
| |
|
| Several characters inhibit history expansion if found immediately following the history expansion character, even if it is unquoted: space, tab, newline, carriage return, and =. If the extglob shell option is enabled, ( will also inhibit expansion.
| | extglobシェル・オプションが有効な場合、()も展開を抑制する。 |
|
| |
|
| Several shell options settable with the shopt builtin may be used to tailor the behavior of history expansion. If the histverify shell option is enabled (see the description of the shopt builtin below), and readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the readline editing buffer for further modification. If readline is being used, and the histreedit shell option is enabled, a failed history substitution will be reloaded into the readline editing buffer for correction.
| | shopt 組み込み関数で設定可能ないくつかのシェル・オプションを使用して、ヒストリ展開の動作を調整することができる。 histverify シェル・オプションが有効で(後述の [[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]の説明を参照)、readline が使用されている場合、ヒストリ置換はシェル・パーサにすぐには渡されない。 その代わりに、展開された行はreadline編集バッファに再ロードされ、さらに修正される。 readlineが使用されていて、histreeditシェルオプションが有効になっている場合、失敗したヒストリ置換は修正のためにreadline編集バッファにリロードされる。 |
| The -p option to the history builtin command may be used to see what a history expansion will do before using it. The -s option to the history builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall.
| | history 組み込みコマンドの -p オプションを使用すると、ヒストリ拡張を使用する前に、その拡張が何をするかを確認することができる。 history組み込みコマンドの-sオプションは、コマンドを実際に実行することなく、履歴リストの最後に追加するために使用される。 |
|
| |
|
| The shell allows control of the various characters used by the history expansion mechanism (see the description of histchars above under Shell Variables). The shell uses the history comment character to mark history timestamps when writing the history file.
| | シェルでは、ヒストリ展開メカニズムで使用されるさまざまな文字を制御できる(上記の「[[#Shell Variables|Shell Variables ]]」の「histchars」の説明を参照のこと)。 シェルはヒストリファイルを書き込む際に、ヒストリのタイムスタンプをマークするためにヒストリコメント文字を使用する。 |
|
| |
|
| === Event Designators === | | === Event Designators === |
| An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.
| | イベント・デジグネーターは、ヒストリーリスト内のコマンドラインエントリーの参照である。 参照が絶対的でない限り、イベントはヒストリーリストの現在の位置からの相対的なものである。 |
| ;! | | ;! |
| :Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin). | | :空白、改行、キャリッジリターン、=、または ( shopt 組み込み関数で extglob シェルオプションが有効になっている場合) が続く場合を除き、履歴置換を開始する。 |
| ;!n | | ;!n |
| :Refer to command line n. | | :コマンドラインnを参照のこと。 |
| ;!-n | | ;!-n |
| :Refer to the current command minus n. | | :現在のコマンドマイナスnを参照。 |
| ;!! | | ;!! |
| :Refer to the previous command. This is a synonym for `!-1'. | | :前のコマンドを参照のこと。 これは `!-1' と同意語である。 |
| ;!string | | ;!string |
| :Refer to the most recent command preceding the current position in the history list starting with string. | | :文字列で始まる履歴リストで、現在の位置より前にある最新のコマンドを参照する。 |
| ;!?string<nowiki>[?]</nowiki> | | ;!?string<nowiki>[?]</nowiki> |
| :Refer to the most recent command preceding the current position in the history list containing string. The trailing ? may be omitted if string is followed immediately by a newline. If string is missing, the string from the most recent search is used; it is an error if there is no previous search string. | | :stringを含む履歴リストで、現在の位置より前にある最新のコマンドを参照する。 stringの直後に改行が続く場合、末尾の ? は省略できる。 stringがない場合、最新の検索文字列が使われる。以前の検索文字列がない場合はエラーとなる。 |
| ;^string1^string2^ | | ;^string1^string2^ |
| :Quick substitution. Repeat the previous command, replacing string1 with string2. Equivalent to ``!!:s^string1^string2^'' (see Modifiers below). | | :素早く置換する。 文字列1を文字列2に置き換えて、前のコマンドを繰り返す。 (以下の[[#Modifiers|Modifiers ]]を参照のこと)。 |
| ;!# | | ;!# |
| :The entire command line typed so far. | | :これまでに入力されたコマンドライン全体。 |
|
| |
|
| === Word Designators === | | === Word Designators === |
| Word designators are used to select desired words from the event. A : separates the event specification from the word designator. It may be omitted if the word designator begins with a ^, $, *, -, or %. Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). Words are inserted into the current line separated by single spaces.
| | 単語指定子は、イベントから必要な単語を選択するために使用される。 は、イベントの指定と単語指示子を区切る。 単語指定子が^、$、*、-、%で始まる場合は省略できる。 単語は行頭から順に番号付けされ、最初の単語は0(ゼロ)で示される。 単語は、現在の行に半角スペースで区切って挿入される。 |
|
| |
|
| ;0 (zero) | | ;0 (zero) |
| :The zeroth word. For the shell, this is the command word. | | :番目の単語。 シェルでは、これはコマンドワードである。 |
| ;n | | ;n |
| :The nth word. | | :The nth word. |
| ;^ | | ;^ |
| :The first argument. That is, word 1. | | :最初の引数。 つまり単語1である。 |
| ;$ | | ;$ |
| :The last word. This is usually the last argument, but will expand to the zeroth word if there is only one word in the line. | | :最後の単語。 これは通常最後の引数だが、行に単語が1つしかない場合は0番目の単語に展開される。 |
| ;% | | ;% |
| :The first word matched by the most recent `?string?' search, if the search string begins with a character that is part of a word. | | :検索文字列が単語の一部である文字で始まっている場合、直近の `?string?' 検索でマッチした最初の単語。 |
| ;x-y | | ;x-y |
| :A range of words; `-y' abbreviates `0-y'. | | :'-y'は'0-y'を省略したものである。 |
| ;* | | ;* |
| :All of the words but the zeroth. This is a synonym for `1-$'. It is not an error to use * if there is just one word in the event; the empty string is returned in that case. | | :0番目以外のすべての単語。 これは `1-$' と同意語である。 その場合は空文字列が返される。 |
| ;x* | | ;x* |
| :Abbreviates x-$. | | :Abbreviates x-$. |
| ;x- | | ;x- |
| :Abbreviates x-$ like x*, but omits the last word. If x is missing, it defaults to 0. | | :x*のようにx-$を省略するが、最後の単語は省略する。 xがない場合、デフォルトは0になる。 |
|
| |
|
| If a word designator is supplied without an event specification, the previous command is used as the event.
| | イベント指定なしで単語指定子を与えた場合、前のコマンドがイベントとして使用される。 |
|
| |
|
| === Modifiers === | | === Modifiers === |
| After the optional word designator, there may appear a sequence of one or more of the following modifiers, each preceded by a `:'. These modify, or edit, the word or words selected from the history event.
| | オプションの単語指示子の後には、それぞれ`:'で始まる1つ以上の修飾子が現れる。 これらは、履歴イベントから選択された単語を修正する。 |
|
| |
|
| ;h | | ;h |
| :Remove a trailing filename component, leaving only the head. | | :末尾のファイル名コンポーネントを削除し、先頭だけを残す。 |
| ;t | | ;t |
| :Remove all leading filename components, leaving the tail. | | :ファイル名の先頭をすべて削除し、末尾を残す。 |
| ;r | | ;r |
| :Remove a trailing suffix of the form .xxx, leaving the basename. | | :.xxx 形式の末尾のサフィックスを削除し、ベース名を残す。 |
| ;e | | ;e |
| :Remove all but the trailing suffix. | | :末尾の接尾辞以外はすべて削除する。 |
| ;p | | ;p |
| :Print the new command but do not execute it. | | :新しいコマンドを表示するが、実行はしない。 |
| ;q | | ;q |
| :Quote the substituted words, escaping further substitutions. | | :置換された単語を引用し、それ以上の置換を避ける。 |
| ;x | | ;x |
| :Quote the substituted words as with q, but break into words at blanks and newlines. The q and x modifiers are mutually exclusive; the last one supplied is used. | | :qと同様に置換された単語を引用するが、空白と改行で単語を区切る。 q修飾子とx修飾子は互いに排他的であり、最後に与えられたものが使われる。 |
| ;s/old/new/ | | ;s/old/new/ |
| :Substitute new for the first occurrence of old in the event line. Any character may be used as the delimiter in place of /. The final delimiter is optional if it is the last character of the event line. The delimiter may be quoted in old and new with a single backslash. If & appears in new, it is replaced by old. A single backslash will quote the &. If old is null, it is set to the last old substituted, or, if no previous history substitutions took place, the last string in a !?string[?] search. If new is null, each matching old is deleted. | | :イベント行で最初に出現するoldをnewに置き換える。 最後のデリミタは、イベント行の最後の文字であれば任意である。 デリミタは、バックスラッシュ1つでoldとnewで引用することができる。 もし&がnewに現れた場合、それはoldに置き換えられる。 シングル・バックスラッシュは&を引用符で囲む。 oldがNULLの場合、最後に置換されたoldに設定され、それ以前に履歴の置換が行われなかった場合は、!?string[?]検索の最後の文字列に設定される。 newがNULLの場合、一致するoldはすべて削除される。 |
| ;& | | ;& |
| :Repeat the previous substitution. | | :前の置換を繰り返す。 |
| ;g | | ;g |
| :Cause changes to be applied over the entire event line. This is used in conjunction with `:s' (e.g., `:gs/old/new/') or `:&'. If used with `:s', any delimiter can be used in place of /, and the final delimiter is optional if it is the last character of the event line. An a may be used as a synonym for g. | | :変更をイベント行全体に適用する。 これは `:s' (例えば `:gs/old/new/') または `:&' と組み合わせて使う。 s' と一緒に使う場合、/の代わりにどんな区切り文字でも使うことができ、最後の区切り文字がイベント行の最後の文字であれば省略可能である。 gの同義語としてaを使うこともできる。 |
| ;G | | ;G |
| :Apply the following `s' or `&' modifier once to each word in the event line. | | :以下の`s'または`&'修飾子をイベント行の各単語に1回ずつ適用する。 |
|
| |
|
| == SHELL BUILTIN COMMANDS == | | == SHELL BUILTIN COMMANDS == |
| Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options. The :, true, false, and test/[ builtins do not accept options and do not treat -- specially. The exit, logout, return, break, continue, let, and shift builtins accept and process arguments beginning with - without requiring --.
| | 特に断りのない限り、このセクションでオプションを受け付けるとして文書化されている各 組み込みコマンドは、オプションの終わりを示す -- を受け付ける。 test/[、true、false、test/[ 組み込み関数はオプションを受け付けず、 -- を特別に扱わない。 exit、logout、return、break、continue、let、shift 組み込み関数は、-- を必要とせずに - で始まる引数を受け入れ処理する。 |
| Other builtins that accept arguments but are not specified as accepting options interpret arguments beginning with - as invalid options and require -- to prevent this interpretation.
| | 引数を受け付けるがオプションを受け付けるように指定されていない他の組み込み関数は、 - で始まる引数を無効なオプションとして解釈し、この解釈を防ぐために -- を要求する。 |
| ;<nowiki>: [arguments]</nowiki> | | ;<nowiki>: [arguments]</nowiki> |
| :No effect; the command does nothing beyond expanding arguments and performing any specified redirections. The return status is zero. | | :コマンドは引数を展開し、指定されたリダイレクションを実行するだけで、何もしない。 リターンステータスは0である。 |
|
| |
|
| ;<nowiki>. filename [arguments]</nowiki> | | ;<nowiki>. filename [arguments]</nowiki> |
| ;<nowiki>source filename [arguments]</nowiki> | | ;<nowiki>source filename [arguments]</nowiki> |
| :Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, filenames in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. If the -T option is enabled, source inherits any trap on DEBUG; if it is not, any DEBUG trap string is saved and restored around the call to source, and source unsets the DEBUG trap while it executes. If -T is not set, and the sourced file changes the DEBUG trap, the new value is retained when source completes. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read. | | :現在のシェル環境で filename からコマンドを読み込んで実行し、 filename から最後に実行されたコマンドの終了ステータスを返す。 filename にスラッシュが含まれていない場合、PATH 内のファイル名を使用して filename を含むディレクトリを検索する。 PATHで検索されるファイルは実行可能である必要はない。 bashがposixモードでない場合、PATHにファイルが見つからなければ、カレント・ディレクトリが検索される。 shopt組み込みコマンドのsourcepathオプションがオフの場合、PATHは検索されない。 引数が与えられている場合、それらは filename が実行されるときの位置パラメーターとなる。 それ以外の場合、位置パラメーターは変更されない。 -Tオプションが有効な場合、sourceはDEBUGのトラップを継承する。有効でない場合、DEBUGトラップ文字列はsourceへの呼び出しの周囲に保存および復元され、sourceは実行中にDEBUGトラップの設定を解除する。 Tが設定されておらず、ソース・ファイルがDEBUGトラップを変更した場合、ソースが完了すると新しい値が保持される。 戻りステータスは、スクリプト内で最後に終了したコマンドのステータス(コマンドが実行されていない場合は0)であり、filenameが見つからないか読み取れない場合はfalseである。 |
|
| |
|
| ;<nowiki>alias [-p] [name[=value] ...]</nowiki> | | ;<nowiki>alias [-p] [name[=value] ...]</nowiki> |
| :Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution when the alias is expanded. For each name in the argument list for which no value is supplied, the name and value of the alias is printed. Alias returns true unless a name is given for which no alias has been defined. | | :引数なし、または-pオプションを指定したAliasは、alias name=valueという形式でエイリアスのリストを標準出力に表示する。 引数が与えられると、値が与えられる各名称に対してエイリアスが定義される。 valueの末尾に空白があると、エイリアスが展開されるときに、次の単語でエイリアスの置換がチェックされる。 値が与えられていない引数リストの各名に対して、エイリアスの名前と値が表示される。 エイリアスが定義されていない名前が与えられない限り、Aliasは真を返す。 |
|
| |
|
| ;<nowiki>bg [jobspec ...]</nowiki> | | ;<nowiki>bg [jobspec ...]</nowiki> |
| :Resume each suspended job jobspec in the background, as if it had been started with &. If jobspec is not present, the shell's notion of the current job is used. bg jobspec returns 0 unless run when job control is disabled or, when run with job control enabled, any specified jobspec was not found or was started without job control. | | :中断された各 jobspec をバックグラウンドで再開する。 jobspecが存在しない場合、シェルの現在のジョブの概念が使用される。 bg jobspecは、ジョブ制御が無効になっているときに実行されない限り0を返し、ジョブ制御が有効になっているときに実行された場合は、指定されたjobspecが見つからないか、ジョブ制御なしで開始された。 |
|
| |
|
| ;<nowiki>bind [-m keymap] [-lpsvPSVX]</nowiki> | | ;<nowiki>bind [-m keymap] [-lpsvPSVX]</nowiki> |
Line 1,939: |
Line 1,939: |
| ;<nowiki>bind [-m keymap] keyseq:function-name</nowiki> | | ;<nowiki>bind [-m keymap] keyseq:function-name</nowiki> |
| ;<nowiki>bind [-m keymap] keyseq:readline-command</nowiki> | | ;<nowiki>bind [-m keymap] keyseq:readline-command</nowiki> |
| :Display current readline key and function bindings, bind a key sequence to a readline function or macro, or set a readline variable. Each non-option argument is a command as it would appear in .inputrc, but each binding or command must be passed as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'. Options, if supplied, have the following meanings: | | :現在の readline キーと関数のバインディングを表示したり、キーシーケンスを readline 関数やマクロにバインドしたり、readline 変数を設定したりする。 オプション以外の各引数は、.inputrcに表示されるコマンドであるが、各バインディングまたはコマンドは、別の引数として渡されなければならない;例えば、'"˶-xC-r": re-read-init-file'. オプションが与えられた場合、以下の意味を持つ: |
| ::;-m keymap | | ::;-m keymap |
| :::Use keymap as the keymap to be affected by the subsequent bindings. Acceptable keymap names are emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert. vi is equivalent to vi-command (vi-move is also a synonym); emacs is equivalent to emacs-standard. | | :::後続のバインディングの影響を受けるキーマップとしてkeymapを使う。 使用可能なキーマップ名は、emacs、emacs-standard、 emacs-meta、emacs-ctlx、vi、vi-move、vi-command、vi-insertである。 viはvi-commandと等価であり(vi-moveも同義語である)、emacsは emacs-standardと等価である。 |
| ::;-l | | ::;-l |
| :::List the names of all readline functions. | | :::すべてのreadline関数の名前を列挙する。 |
| ::;-p | | ::;-p |
| :::Display readline function names and bindings in such a way that they can be re-read. | | :::readlineの関数名とバインディングを、再読込できるように表示する。 |
| ::;-P | | ::;-P |
| :::List current readline function names and bindings. | | :::現在のreadline関数名とバインディングをリストアップする。 |
| ::;-s | | ::;-s |
| :::Display readline key sequences bound to macros and the strings they output in such a way that they can be re-read. | | :::マクロにバインドされたreadlineキーシーケンスと、それらが出力する文字列を、再読み取りできるように表示する。 |
| ::;-S | | ::;-S |
| :::Display readline key sequences bound to macros and the strings they output. | | :::マクロにバインドされたreadlineキーシーケンスと、それらが出力する文字列を表示する。 |
| ::;-v | | ::;-v |
| :::Display readline variable names and values in such a way that they can be re-read. | | :::リードラインの変数名と値を再読込できるように表示する。 |
| ::;-V | | ::;-V |
| :::List current readline variable names and values. | | :::現在のリードライン変数の名前と値をリストアップする。 |
| ::;-f filename | | ::;-f filename |
| :::Read key bindings from filename. | | :::ファイル名からキーバインディングを読み込む。 |
| ::;-q function | | ::;-q function |
| :::Query about which keys invoke the named function. | | :::どのキーが指定された関数を呼び出すかを問い合わせる。 |
| ::;-u function | | ::;-u function |
| :::Unbind all keys bound to the named function. | | :::指定された関数にバインドされているすべてのキーをアンバインドする。 |
| ::;-r keyseq | | ::;-r keyseq |
| :::Remove any current binding for keyseq. | | :::keyseqの現在のバインディングを削除する。 |
| ::;-x keyseq:shell-command | | ::;-x keyseq:shell-command |
| :::Cause shell-command to be executed whenever keyseq is entered. When shell-command is executed, the shell sets the READLINE_LINE variable to the contents of the read‐line line buffer and the READLINE_POINT and READLINE_MARK variables to the current location of the insertion point and the saved insertion point (the mark), respectively. If the executed command changes the value of any of READLINE_LINE, READLINE_POINT, or READLINE_MARK, those new values will be reflected in the editing state. | | :::keyseqが入力されるたびにシェルコマンドを実行させる。 shell-commandが実行されると、シェルは'''READLINE_LINE'''変数に読み取り行バッファの内容を設定し、'''READLINE_POINT'''変数と'''READLINE_MARK'''変数にそれぞれ現在の挿入位置と保存された挿入位置(マーク)を設定する。 実行されたコマンドが'''READLINE_LINE'''、'''READLINE_POINT'''、'''READLINE_MARK'''のいずれかの値を変更した場合、それらの新しい値は編集状態に反映される。 |
| ::;-X | | ::;-X |
| :::List all key sequences bound to shell commands and the associated commands in a format that can be reused as input. | | :::シェルコマンドにバインドされているすべてのキーシーケンスと、関連するコマンドを、入力として再利用できる形式でリストアップする。 |
|
| |
|
| The return value is 0 unless an unrecognized option is given or an error occurred.
| | :認識できないオプションが与えられるか、エラーが発生しない限り、戻り値は0である。 |
|
| |
|
| ;break [n] | | ;break [n] |
| :Exit from within a for, while, until, or select loop. If n is specified, break n levels. n must be ≥ 1. If n is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless n is not greater than or equal to 1. | | :for、while、until、selectループの中で終了する。 nが指定された場合、nレベルブレークする。nは1以上でなければならない。 nがループの数より大きい場合、すべてのループが終了する。 nが1以上でなければ、戻り値は0である。 |
|
| |
|
| ;<nowiki>builtin shell-builtin [arguments]</nowiki> | | ;<nowiki>builtin shell-builtin [arguments]</nowiki> |
| :Execute the specified shell builtin, passing it arguments, and return its exit status. This is useful when defining a function whose name is the same as a shell builtin, retaining the functionality of the builtin within the function. The cd builtin is commonly redefined this way. The return status is false if shell-builtin is not a shell builtin command. | | :指定されたシェル組み込み関数に引数を渡して実行し、その終了ステータスを返す。これは、シェル組み込み関数と同じ名前の関数を定義し、関数内で組み込み関数の機能を保持する場合に便利である。 cd 組み込み関数は一般的にこの方法で再定義される。 shell-builtin がシェル組み込みコマンドでない場合、戻り値は false となる。 |
|
| |
|
| ;<nowiki>caller [expr]</nowiki> | | ;<nowiki>caller [expr]</nowiki> |
| :Returns the context of any active subroutine call (a shell function or a script executed with the . or source builtins). Without expr, caller displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as expr, caller displays the line number, subroutine name, and source file corresponding to that position in the current execution call stack. This extra information may be used, for example, to print a stack trace. The current frame is frame 0. The return value is 0 unless the shell is not executing a subroutine call or expr does not correspond to a valid position in the call stack. | | :アクティブなサブルーチン呼び出し(シェル関数、.または source 組み込み関数で実行されるスクリプト)のコンテキストを返す。 expr を指定しないと、呼び出し元は現在のサブルーチン呼び出しの行番号とソースファイル名を表示する。 exprとして負でない整数が指定された場合、呼び出し元は、現在の実行呼び出しスタックのその位置に対応する行番号、サブルーチン名、およびソースファイルを表示する。 この追加情報は、スタックトレースを表示する場合などに使用できる。 シェルがサブルーチン呼び出しを実行していないか、exprがコールスタックの有効な位置に対応していない場合を除き、戻り値は0である。 |
|
| |
|
| ;<nowiki>cd [-L|[-P [-e]] [-@]] [dir]</nowiki> | | ;<nowiki>cd [-L|[-P [-e]] [-@]] [dir]</nowiki> |
| :Change the current directory to dir. if dir is not supplied, the value of the HOME shell variable is the default. Any additional arguments following dir are ignored. The variable CDPATH defines the search path for the directory containing dir: each directory name in CDPATH is searched for dir. Alternative directory names in CDPATH are separated by a colon (:). A null directory name in CDPATH is the same as the current directory, i.e., ``.''. If dir begins with a slash (/), then CDPATH is not used. The -P option causes cd to use the physical directory structure by resolving symbolic links while traversing dir and before processing instances of .. in dir (see also the -P option to the set builtin command); the -L option forces symbolic links to be followed by resolving the link after processing instances of .. in dir. If .. appears in dir, it is processed by removing the immediately previous pathname component from dir, back to a slash or the beginning of dir. If the -e option is supplied with -P, and the current working directory cannot be successfully determined after a successful directory change, cd will return an unsuccessful status. On systems that support it, the -@ option presents the extended attributes associated with a file as a directory. An argument of - is converted to $OLDPWD before the directory change is attempted. If a non-empty directory name from CDPATH is used, or if - is the first argument, and the directory change is successful, the absolute pathname of the new working directory is written to the standard output. The return value is true if the directory was successfully changed; false otherwise. | | :dirが与えられない場合、'''HOME'''シェル変数の値が デフォルトとなる。 dirに続く追加の引数は無視される。 変数'''CDPATH'''は、dirを含むディレクトリの検索パスを定義する。 '''CDPATH'''内の代替ディレクトリ名は、コロン(:)で区切られる。 '''CDPATH'''内のディレクトリ名がNULLの場合、カレントディレクトリと同じ、つまり ``. dirがスラッシュ(/)で始まる場合、'''CDPATH'''は使われない。 -Pオプションをつけると、cdはdirを走査している間、dir中の...のインスタンスを処理する前にシンボリックリンクを解決して物理的なディレクトリ構造を使用するようになる(set組み込みコマンドの-Pオプションも参照のこと)。 .がdirに現れた場合、dirから直前のパス名コンポーネントを削除し、スラッシュまたはdirの先頭に戻して処理される。-Pとともに-eオプションが与えられ、ディレクトリ変更に成功した後にカレント作業ディレクトリを正しく決定できない場合、cdは失敗ステータスを返す。 これをサポートするシステムでは、-@オプションは、ファイルに関連する拡張属性をディレクトリとして表示する。 引数-は、ディレクトリの変更を試みる前に$OLDPWDに変換される。 '''CDPATH'''から空でないディレクトリ名が使用された場合、または - が最初の引数で、ディレクトリ変更が成功した場合、 新しい作業ディレクトリの絶対パス名が標準出力に書き出される。 戻り値は、ディレクトリの変更が成功した場合は真、そうでない場合は偽である。 |
|
| |
|
| ;<nowiki>command [-pVv] command [arg ...]</nowiki> | | ;<nowiki>command [-pVv] command [arg ...]</nowiki> |
| :Run command with args suppressing the normal shell function lookup. Only builtin commands or commands found in the PATH are executed. If the -p option is given, the search for command is performed using a default value for PATH that is guaranteed to find all of the standard utilities. If either the -V or -v option is supplied, a description of command is printed. The -v option causes a single word indicating the command or filename used to invoke command to be displayed; the -V option produces a more verbose description. If the -V or -v option is supplied, the exit status is 0 if command was found, and 1 if not. If neither option is supplied and an error occurred or command cannot be found, the exit status is 127. Otherwise, the exit status of the command builtin is the exit status of command. | | :通常のシェル関数検索を抑制して、argsでコマンドを実行する。 組み込みコマンドまたは '''PATH''' で見つかったコマンドのみが実行される。 -pオプションが与えられると、標準ユーティリティがすべて見つかることが保証されている'''PATH'''のデフォルト値を用いてコマンドの検索が行われる。 -Vまたは-vオプションが与えられると、コマンドの説明が表示される。 -vオプションを指定すると、コマンドを呼び出すために使用されたコマンドまたはファイル名を示す単一の単語が表示される。 -Vまたは-vオプションが指定された場合、コマンドが見つかれば終了ステータスは0になり、見つからなければ1になる。 どちらのオプションも指定されず、エラーが発生したかコマンドが見つからなかった場合、終了ステータスは127となる。 それ以外の場合は、コマンド組み込み関数の終了ステータスが command の終了ステータスになる。 |
|
| |
|
| ;<nowiki>compgen [option] [word]</nowiki> | | ;<nowiki>compgen [option] [word]</nowiki> |
| :Generate possible completion matches for word according to the options, which may be any option accepted by the complete builtin with the exception of -p and -r, and write the matches to the standard output. When using the -F or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful values. | | :-pと-rを除く、complete組み込み関数が受け付けるどのオプションでもよい。 -F または -C オプションを使用する場合、プログラム可能な補完機能によって設定されるさまざまなシェル変数は使用可能であるが、有用な値を持たない。 |
|
| |
|
| :The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word will be displayed. | | :マッチは、プログラマブル補完コードが同じフラグを持つ補完指定から直接生成したのと同じ方法で生成される。 wordが指定された場合、wordにマッチする補完のみが表示される。 |
|
| |
|
| The return value is true unless an invalid option is supplied, or no matches were generated.
| | :無効なオプションが与えられるか、マッチが生成されない限り、戻り値は真である。 |
|
| |
|
| ;<nowiki>complete [-abcdefgjksuv] [-o comp-option] [-DEI] [-A action] [-G globpat] [-W wordlist]</nowiki> | | ;<nowiki>complete [-abcdefgjksuv] [-o comp-option] [-DEI] [-A action] [-G globpat] [-W wordlist]</nowiki> |
| :;<nowiki>[-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] name [name ...]</nowiki> | | :;<nowiki>[-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] name [name ...]</nowiki> |
| ;<nowiki>complete -pr [-DEI] [name ...]</nowiki> | | ;<nowiki>complete -pr [-DEI] [name ...]</nowiki> |
| Specify how arguments to each name should be completed. If the -p option is supplied, or if no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. The -r option removes a completion specification for each name, or, if no names are supplied, all completion specifications. The -D option indicates that other supplied options and actions should apply to the ``default'' command completion; that is, completion attempted on a command for which no completion has previously been defined. The -E option indicates that other supplied options and actions should apply to ``empty'' command completion; that is, completion attempted on a blank line. The -I option indicates that other supplied options and actions should apply to completion on the initial non-assignment word on the line, or after a command delimiter such as ; or |, which is usually command name completion. If multiple options are supplied, the -D option takes precedence over -E, and both take precedence over -I. If any of -D, -E, or -I are supplied, any other name arguments are ignored; these completions only apply to the case specified by the option.
| | :各名前に対する引数をどのように補完するかを指定する。 -pオプションが与えられている場合、またはオプションが与えられていない場合、既存の補完指定が入力として再利用できるような形で出力される。 rオプションは、各名前の補完指定を削除し、名前が与えられていない場合は、すべての補完指定を削除する。 -Dオプションは、他のオプションやアクションが``default''コマンドの 補完に適用されることを示す。 -Eオプションは他のオプションやアクションが``empty''コマンド補完に適用されることを示す。 -Iオプションは、他のオプションやアクションが、その行の最初の非割り当ての単語、またはコマンドの区切り文字(;や|など)の後の補完に適用されることを示す。 複数のオプションが指定された場合、-Dオプションは-Eよりも優先され、両者は-Iよりも優先される。 -D、-E、-Iのいずれかを指定すると、他の名前引数は無視される。 |
|
| |
|
| The process of applying these completion specifications when word completion is attempted is described above under Programmable Completion.
| | :これらの補完は、オプションで指定された場合にのみ適用される。単語補完が試みられたときにこれらの補完指定を適用する処理については、上記の「プログラム可能な補完」で説明されている。 |
|
| |
|
| Other options, if specified, have the following meanings. The arguments to the -G, -W, and -X options (and, if necessary, the -P and -S options) should be quoted to protect them from expansion before the complete builtin is invoked.
| | :その他のオプションが指定されている場合は、以下の意味を持つ。 G、-W、-Xオプションの引数(必要であれば-Pと-Sオプションも) は、組み込み関数が起動する前に展開されないように引用符で囲む。 |
| :;-o comp-option | | :;-o comp-option |
| ::The comp-option controls several aspects of the compspec's behavior beyond the simple generation of completions. comp-option may be one of: | | ::comp-optionは、単純な補完の生成だけでなく、compspecの動作のいくつかの側面を制御する: |
| :::bashdefault | | :::bashdefault |
| ::::Perform the rest of the default bash completions if the compspec generates no matches. | | ::::compspecがマッチを生成しなかった場合、残りのデフォルトのbash補完を実行する。 |
| :::default | | :::default |
| ::::Use readline's default filename completion if the compspec generates no matches. | | ::::compspecがマッチを生成しない場合、readlineのデフォルトのファイル名補完を使用する。 |
| :::dirnames | | :::dirnames |
| ::::Perform directory name completion if the compspec generates no matches. | | ::::compspecがマッチを生成しない場合、ディレクトリ名の補完を行う。 |
| :::filenames | | :::filenames |
| ::::Tell readline that the compspec generates filenames, so it can perform any filename-specific processing (like adding a slash to directory names, quoting special characters, or suppressing trailing spaces). Intended to be used with shell functions. | | ::::readlineに、compspecがファイル名を生成することを伝え、ファイル名固有の処理(ディレクトリ名にスラッシュを追加したり、特殊文字を引用したり、末尾の空白を抑えたり)を実行できるようにする。 シェル関数と一緒に使うことを意図している。 |
| :::noquote | | :::noquote |
| ::::Tell readline not to quote the completed words if they are filenames (quoting filenames is the default). | | ::::readlineに、完了した単語がファイル名の場合は引用しないように指示する(ファイル名を引用するのがデフォルト)。 |
| :::nosort | | :::nosort |
| ::::Tell readline not to sort the list of possible completions alphabetically. | | ::::readlineに、補完可能リストをアルファベット順に並べ替えないように指示する。 |
| :::nospace | | :::nospace |
| ::::Tell readline not to append a space (the default) to words completed at the end of the line. | | ::::readlineに、行末で完了した単語にスペース(デフォルト)を追加しないように指示する。 |
| :::plusdirs | | :::plusdirs |
| ::::After any matches defined by the compspec are generated, directory name completion is attempted and any matches are added to the results of the other actions. | | ::::compspecで定義されたマッチが生成された後、ディレクトリ名の補完が試みられ、マッチしたものは他のアクションの結果に追加される。 |
| :;-A action | | :;-A action |
| ::The action may be one of the following to generate a list of possible completions: | | ::アクションは以下のいずれかであり、可能性のある完了のリストを生成する: |
| :::alias | | :::alias |
| ::::Alias names. May also be specified as -a. | | ::::エイリアス名。 -aとして指定することもできる。 |
| :::arrayvar | | :::arrayvar |
| ::::Array variable names. | | ::::配列変数名。 |
| :::binding | | :::binding |
| ::::Readline key binding names. | | ::::キーバインディング名を読み込む。 |
| :::builtin | | :::builtin |
| ::::Names of shell builtin commands. May also be specified as -b. | | ::::シェル組み込みコマンドの名前。 -bとしても指定できる。 |
| :::command | | :::command |
| ::::Command names. May also be specified as -c. | | ::::コマンド名。 -cとしても指定できる。 |
| :::directory | | :::directory |
| ::::Directory names. May also be specified as -d. | | ::::ディレクトリ名。 dとしても指定できる。 |
| :::disabled | | :::disabled |
| ::::Names of disabled shell builtins. | | ::::無効化されたシェルビルトインの名前。 |
| :::enabled | | :::enabled |
| ::::Names of enabled shell builtins. | | ::::使用可能なシェルビルトインの名前。 |
| :::export | | :::export |
| ::::Names of exported shell variables. May also be specified as -e. | | ::::エクスポートされるシェル変数の名前。 -e として指定することもできる。 |
| :::file | | :::file |
| ::::File names. May also be specified as -f. | | ::::ファイル名。 -fを指定することもできる。 |
| :::function | | :::function |
| ::::Names of shell functions. | | ::::シェル関数の名前。 |
| :::group | | :::group |
| ::::Group names. May also be specified as -g. | | ::::グループ名。 -gとしても指定できる。 |
| :::helptopic | | :::helptopic |
| ::::Help topics as accepted by the help builtin. | | ::::helpビルトインが受け付けるヘルプトピック。 |
| :::hostname | | :::hostname |
| ::::Hostnames, as taken from the file specified by the HOSTFILE shell variable. | | ::::HOSTFILEシェル変数で指定されたファイルから取られたホスト名。 |
| :::job | | :::job |
| ::::Job names, if job control is active. May also be specified as -j. | | ::::ジョブ制御が有効な場合は、ジョブ名。 -jとしても指定できる。 |
| :::keyword | | :::keyword |
| ::::Shell reserved words. May also be specified as -k. | | ::::シェル予約語。 -kとしても指定できる。 |
| :::running | | :::running |
| ::::Names of running jobs, if job control is active. | | ::::ジョブ制御が有効な場合、実行中のジョブの名前。 |
| :::service | | :::service |
| ::::Service names. May also be specified as -s. | | ::::サービス名。 -sとしても指定できる。 |
| :::setopt | | :::setopt |
| ::::Valid arguments for the -o option to the set builtin. | | ::::set 組み込み関数に対する -o オプションの有効な引数。 |
| :::shopt | | :::shopt |
| ::::Shell option names as accepted by the shopt builtin. | | ::::shopt 組み込み関数が受け付けるシェルオプション名。 |
| :::signal | | :::signal |
| ::::Signal names. | | ::::シグナルの名前。 |
| :::stopped | | :::stopped |
| ::::Names of stopped jobs, if job control is active. | | ::::ジョブ制御が有効な場合、停止しているジョブの名前。 |
| :::user | | :::user |
| ::::User names. May also be specified as -u. | | ::::ユーザー名。 -uとしても指定できる。 |
| :::variable | | :::variable |
| ::::Names of all shell variables. May also be specified as -v. | | ::::すべてのシェル変数の名前。 v として指定することもできる。 |
| :;-C command | | :;-C command |
| ::command is executed in a subshell environment, and its output is used as the possible completions. | | ::コマンドはサブシェル環境で実行され、その出力が可能な補完として使われる。 |
| :;-F function | | :;-F function |
| ::The shell function function is executed in the current shell environment. When the function is executed, the first argument ($1) is the name of the command whose arguments are being completed, the second argument ($2) is the word being completed, and the third argument ($3) is the word preceding the word being completed on the current command line. When it finishes, the possible completions are retrieved from the value of the COMPREPLY array variable. | | ::シェル関数関数は、現在のシェル環境で実行される。 この関数が実行されると、第1引数($1)は補完される引数のコマンド名、第2引数($2)は補完される単語、第3引数($3)は現在のコマンド行で補完される単語の前の単語である。 終了すると、COMPREPLY配列変数の値から可能な補完が検索される。 |
| :;-G globpat | | :;-G globpat |
| ::The pathname expansion pattern globpat is expanded to generate the possible completions. | | ::パス名展開パターンglobpatが展開され、可能な補完が生成される。 |
| :;-P prefix | | :;-P prefix |
| ::prefix is added at the beginning of each possible completion after all other options have been applied. | | ::接頭辞は、他のすべてのオプションが適用された後、各完了候補の先頭に追加される。 |
| :;-S suffix | | :;-S suffix |
| ::suffix is appended to each possible completion after all other options have been applied. | | ::サフィックスは、他のすべてのオプションが適用された後、各完了可能なものに付加される。 |
| :;-W wordlist | | :;-W wordlist |
| ::The wordlist is split using the characters in the IFS special variable as delimiters, and each resultant word is expanded. Shell quoting is honored within wordlist, in order to provide a mechanism for the words to contain shell metacharacters or characters in the value of IFS. The possible completions are the members of the resultant list which match the word being completed. | | ::ワードリストは特殊変数IFSの文字を区切り文字として分割され、各単語が展開される。 単語の中にシェルのメタ文字やIFSの値に含まれる文字があってもよいように、単語リスト内ではシェル引用符で囲む。 可能な補完は、補完される単語にマッチする結果リストのメンバーである。 |
| :;-X filterpat | | :;-X filterpat |
| ::filterpat is a pattern as used for pathname expansion. It is applied to the list of possible completions generated by the preceding options and arguments, and each completion matching filterpat is removed from the list. A leading ! in filterpat negates the pattern; in this case, any completion not matching filterpat is removed. | | ::filterpatはパス名展開に使われるパターンである。 これは、直前のオプションと引数で生成された補完候補のリストに適用され、 filterpatにマッチする補完がリストから取り除かれる。 filterpat の先頭の ! はパターンを否定する。この場合、 filterpat にマッチしない補完はすべて取り除かれる。 |
|
| |
|
| :The return value is true unless an invalid option is supplied, an option other than -p or -r is supplied without a name argument, an attempt is made to remove a completion specification for a name for which no specification exists, or an error occurs adding a completion specification. | | :無効なオプションが指定された場合、-pまたは-r以外のオプションが name引数なしで指定された場合、指定が存在しない名前の補完指定を削除しようとした場合、または補完指定の追加エラーが発生した場合を除き、戻り値は真である。 |
|
| |
|
| ;<nowiki>compopt [-o option] [-DEI] [+o option] [name]</nowiki> | | ;<nowiki>compopt [-o option] [-DEI] [+o option] [name]</nowiki> |
| :Modify completion options for each name according to the options, or for the currently-executing completion if no names are supplied. If no options are given, display the completion options for each name or the current completion. The possible values of option are those valid for the complete builtin described above. The -D option indicates that other supplied options should apply to the ``default'' command completion; that is, completion attempted on a command for which no completion has previously been defined. The -E option indicates that other supplied options should apply to ``empty'' command completion; that is, completion attempted on a blank line. The -I option indicates that other supplied options should apply to completion on the initial non-assignment word on the line, or after a command delimiter such as ; or |, which is usually command name completion. | | :オプションにしたがって各名称の補完オプションを変更するか、名前が与えられていない場合は現在実行中の補完オプションを変更する。 オプションが与えられない場合は、各名前または現在実行中の補完の補完オプションを表示する。 optionに指定できる値は、前述の完全組み込み関数で有効な値である。 Dオプションは、他のオプションが ``デフォルト'' コマンド補完に適用されることを示す。 Eオプションは、他のオプションが``empty''コマンド補完に適用される ことを示す。 Iオプションは、他のオプションが、その行の最初の非割り当ての単語、またはコマンドの区切り文字である;や|の後の補完に適用されることを示す。 |
|
| |
|
| :The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a name for which no completion specification exists, or an output error occurs. | | :無効なオプションが与えられるか、補完指定が存在しない名前のオプションを変更しようとするか、出力エラーが発生しない限り、戻り値は真である。 |
|
| |
|
| ;<nowiki>continue [n]</nowiki> | | ;<nowiki>continue [n]</nowiki> |
| :Resume the next iteration of the enclosing for, while, until, or select loop. If n is specified, resume at the nth enclosing loop. n must be ≥ 1. If n is greater than the number of enclosing loops, the last enclosing loop (the ``top-level'' loop) is resumed. The return value is 0 unless n is not greater than or equal to 1. | | :for、while、until、またはselectループの次の反復を再開する。 nが指定された場合、n番目のループで再開する。 nがループの数より大きい場合、最後のループ(``トップレベル''ループ)が再開される。nが1以上でなければ、戻り値は0である。 |
|
| |
|
| ;<nowiki>declare [-aAfFgiIlnrtux] [-p] [name[=value] ...]</nowiki> | | ;<nowiki>declare [-aAfFgiIlnrtux] [-p] [name[=value] ...]</nowiki> |
| ;<nowiki>typeset [-aAfFgiIlnrtux] [-p] [name[=value] ...]</nowiki> | | ;<nowiki>typeset [-aAfFgiIlnrtux] [-p] [name[=value] ...]</nowiki> |
| Declare variables and/or give them attributes. If no names are given then display the values of variables. The -p option will display the attributes and values of each name. When -p is used with name arguments, additional options, other than -f and -F, are ignored. When -p is supplied without name arguments, it will display the attributes and values of all variables having the attributes specified by the additional options. If no other options are supplied with -p, declare will display the attributes and values of all shell variables. The -f option will restrict the display to shell functions. The -F option inhibits the display of function definitions; only the function name and attributes are printed. If the extdebug shell option is enabled using shopt, the source file name and line number where each name is defined are displayed as well. The -F option implies -f. The -g option forces variables to be created or modified at the global scope, even when declare is executed in a shell function. It is ignored in all other cases. The -I option causes local variables to inherit the attributes (except the nameref attribute) and value of any existing variable with the same name at a surrounding scope. If there is no existing variable, the local variable is initially unset. The following options can be used to restrict output to variables with the specified attribute or to give variables attributes:
| | :変数を宣言したり、属性を与えたりする。 名前が与えられていない場合は、変数の値を表示する。 -pオプションは、それぞれの名前の属性と値を表示する。-pが名前引数とともに使われた場合、-fと-F以外の追加オプションは無視される。 名前引数なしで -p を指定すると、追加オプションで指定された属性を持つすべての変数の属性と値が表示される。 他のオプションが -p とともに与えられない場合、 declare はすべてのシェル変数の属性と値を表示する。 -f オプションは、表示をシェル関数に限定する。 -F オプションは関数定義の表示を禁止し、関数名と属性のみが表示される。 shoptを使用してextdebugシェル・オプションを有効にすると、各名称が定義されているソース・ファイル名と行番号も表示される。 -F オプションは -f を意味する。 gオプションは、declareがシェル関数の中で実行された場合でも、変数をグローバル・スコープで作成または変更することを強制する。 それ以外の場合は無視される。 -Iオプションは、ローカル変数の属性(nameref属性を除く)と値を、周囲のスコープに存在する同名の変数に継承させる。 既存の変数がない場合、ローカル変数は初期状態で設定されない。 以下のオプションを使うと、指定した属性を持つ変数に出力を制限したり、変数に属性を与えたりすることができる: |
| :;-a | | :;-a |
| :::Each name is an indexed array variable (see Arrays above). | | :::各名称はインデックス付き配列変数である(上記の「[[#Arrays|Arrays ]]」を参照)。 |
| :;-A | | :;-A |
| ::Each name is an associative array variable (see Arrays above). | | ::それぞれの名前は連想配列変数である(上記の「[[#Arrays|Arrays ]]」を参照)。 |
| :;-f | | :;-f |
| ::Use function names only. | | ::関数名のみを使用する。 |
| :;-i | | :;-i |
| ::The variable is treated as an integer; arithmetic evaluation (see ARITHMETIC EVALUATION above) is performed when the variable is assigned a value. | | ::変数は整数として扱われ、変数に値が代入されると算術評価(上記のARITHMETIC EVALUATIONを参照)が行われる。 |
| :;-l | | :;-l |
| ::When the variable is assigned a value, all upper-case characters are converted to lower-case. The upper-case attribute is disabled. | | ::変数に値が代入されると、大文字はすべて小文字に変換される。 大文字属性は無効になる。 |
| :;-n | | :;-n |
| ::Give each name the nameref attribute, making it a name reference to another variable. That other variable is defined by the value of name. All references, assignments, and attribute modifications to name, except those using or changing the -n attribute itself, are performed on the variable referenced by name's value. The nameref attribute cannot be applied to array variables. | | ::それぞれのnameにnameref属性を与え、別の変数への名前参照とする。 その別の変数は name の値によって定義される。 nameに対するすべての参照、代入、属性の変更は、-n属性そのものを使用または変更するものを除き、nameの値によって参照される変数に対して実行される。 nameref属性は配列変数には適用できない。 |
| :;-r | | :;-r |
| ::Make names readonly. These names cannot then be assigned values by subsequent assignment statements or unset. | | ::名前を読み取り専用にする。 これらの名前は、その後の代入文やアンセットによって値を代入することはできない。 |
| :;-t | | :;-t |
| ::Give each name the trace attribute. Traced functions inherit the DEBUG and RETURN traps from the calling shell. The trace attribute has no special meaning for variables. | | ::それぞれの名前に trace 属性を与える。 トレースされた関数は、呼び出し元のシェルから DEBUG と RETURN トラップを継承する。 trace 属性は変数に対して特別な意味を持たない。 |
| :;-u | | :;-u |
| ::When the variable is assigned a value, all lower-case characters are converted to upper-case. The lower-case attribute is disabled. | | ::変数に値が代入されると、小文字はすべて大文字に変換される。 小文字属性は無効になる。 |
| :;-x | | :;-x |
| ::Mark names for export to subsequent commands via the environment. | | ::環境を通して後続のコマンドにエクスポートする名前をマークする。 |
|
| |
|
| :Using `+' instead of `-' turns off the attribute instead, with the exceptions that +a and +A may not be used to destroy array variables and +r will not remove the readonly attribute. When used in a function, declare and typeset make each name local, as with the local command, unless the -g option is supplied. If a variable name is followed by =value, the value of the variable is set to value. When using -a or -A and the compound assignment syntax to create array variables, additional attributes do not take effect until subsequent assignments. The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using ``-f foo=bar'', an attempt is made to assign a value to a readonly variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax (see Arrays above), one of the names is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-existent function with -f. | | :ただし、+aや+Aは配列変数を破棄するのに使ってはならず、+rはreadonly属性を削除しない。 関数内で使用する場合、-gオプションが与えられていない限り、declareとtypesetはlocalコマンドと同様に各変数名をローカルにする。 変数名の後に=valueが続くと、その変数の値がvalueに設定される。 -a または -A と複合代入構文を使用して配列変数を作成する場合、追加の属性はそれ以降の代入まで有効にならない。 無効なオプションに出会った場合、``-f foo=bar''を使って関数を定義しようとした場合、 読み取り専用変数に値を代入しようとした場合、複合代入構文を使わずに配列変数に 値を代入しようとした場合(上記の配列を参照)を除いて、戻り値は0である、 名前のいずれかが有効なシェル変数名でない、読み取り専用変数の読み取りステータスをオフにしようとした、配列変数の配列ステータスをオフにしようとした、存在しない関数を -f で表示しようとした。 |
|
| |
|
| ;<nowiki>dirs [-clpv] [+n] [-n]</nowiki> | | ;<nowiki>dirs [-clpv] [+n] [-n]</nowiki> |
| :Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the pushd command; the popd command removes entries from the list. The current directory is always the first directory in the stack. | | :オプションなしで、現在記憶しているディレクトリのリストを表示する。 デフォルトでは、ディレクトリ名をスペースで区切って1行で表示する。 ディレクトリは pushd コマンドでリストに追加され、 popd コマンドはリストからエントリを削除する。 カレント・ディレクトリは常にスタックの最初のディレクトリである。 |
| :;-c | | :;-c |
| ::Clears the directory stack by deleting all of the entries. | | ::すべてのエントリを削除してディレクトリスタックをクリアする。 |
| :;-l | | :;-l |
| ::Produces a listing using full pathnames; the default listing format uses a tilde to denote the home directory. | | ::デフォルトのリスト形式では、ホームディレクトリを示すためにチルダを使用する。 |
| :;-p | | :;-p |
| ::Print the directory stack with one entry per line. | | ::ディレクトリスタックを1行1エントリで表示する。 |
| :;-v | | :;-v |
| ::Print the directory stack with one entry per line, prefixing each entry with its index in the stack. | | ::各エントリの先頭にスタック内のインデックスを付けて、1行に1エントリずつディレクトリスタックを表示する。 |
| :;+n | | :;+n |
| ::Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero. | | ::オプションなしで起動した場合、dirsが表示するリストの左から数えてn番目のエントリーを、ゼロから順に表示する。 |
| :;-n | | :;-n |
| ::Displays the nth entry counting from the right of the list shown by dirs when invoked without options, starting with zero. | | ::オプションなしで起動した場合、dirsが表示するリストの右から数えてn番目のエントリーを、ゼロから順に表示する。 |
|
| |
|
| :The return value is 0 unless an invalid option is supplied or n indexes beyond the end of the directory stack. | | :無効なオプションが与えられるか、n個のインデックスがディレクトリスタッ クの末尾を超えない限り、戻り値は0である。 |
|
| |
|
| ;<nowiki>disown [-ar] [-h] [jobspec ... | pid ... ]</nowiki> | | ;<nowiki>disown [-ar] [-h] [jobspec ... | pid ... ]</nowiki> |
Line 2,781: |
Line 2,781: |
|
| |
|
| == SHELL COMPATIBILITY MODE == | | == SHELL COMPATIBILITY MODE == |
| Bash-4.0 introduced the concept of a `shell compatibility level', specified as a set of options to the shopt builtin compat31, compat32, compat40, compat41, and so on). There is only one current compatibility level -- each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions while they migrate scripts to use current features and behavior. It's intended to be a temporary solution. | | Bash-4.0では「シェル互換性レベル」という概念が導入され、shopt組み込みのcompat31、compat32、compat40、compat41などに対するオプションのセットとして指定される。) 現在の互換性レベルは1つだけで、各オプションは相互に排他的である。 互換性レベルは、ユーザーが新しいバージョンと互換性のない旧バージョンの動作を選択できるようにするためのもので、スクリプトを移行して現在の機能と動作を使用できるようにするためのものである。これは一時的な解決策である。 |
|
| |
|
| This section does not mention behavior that is standard for a particular version (e.g., setting compat32 means that quoting the rhs of the regexp matching operator quotes special regexp characters in the word, which is default behavior in bash-3.2 and above).
| | このセクションでは、特定のバージョンで標準となっている動作については言及しない(例えば、compat32を設定することは、正規表現マッチング演算子のrhsを引用することで、単語内の特殊な正規表現文字を引用することを意味し、これはbash-3.2以上のデフォルトの動作である)。 |
|
| |
|
| If a user enables, say, compat32, it may affect the behavior of other compatibility levels up to and including the current compatibility level. The idea is that each compatibility level controls behavior that changed in that version of bash, but that behavior may have been present in earlier versions. For instance, the change to use locale-based comparisons with the [[ command came in bash-4.1, and earlier versions used ASCII-based comparisons, so enabling compat32 will enable ASCII-based comparisons as well. That granularity may not be sufficient for all uses, and as a result users should employ compatibility levels carefully. Read the documentation for a particular feature to find out the current behavior.
| | ユーザーが例えばcompat32を有効にすると、現在の互換性レベルまでの他の互換性レベルの動作に影響を与える可能性がある。 各互換性レベルは、そのバージョンのbashで変更された動作を制御するが、その動作は以前のバージョンにもあったかもしれないという考え方である。 例えば、[[ コマンドでロケール・ベースの比較を使用するようになったのはbash-4.1からで、それ以前のバージョンではASCIIベースの比較を使っていたため、compat32を有効にするとASCIIベースの比較も有効になる。 そのため、compat32を有効にすると、ASCIIベースの比較も有効になる。この細かさは、すべての用途に十分とは限らないので、ユーザーは互換性レベルを慎重に使用すべきである。 現在の動作を知るには、特定の機能のドキュメントを読むこと。 |
|
| |
|
| Bash-4.3 introduced a new shell variable: BASH_COMPAT. The value assigned to this variable (a decimal version number like 4.2, or an integer corresponding to the compatNN option, like 42) determines the compatibility level. | | Bash-4.3は新しいシェル変数を導入した: BASH_COMPATである。 この変数に代入される値(4.2のような10進数のバージョン番号、または42のようなcompatNNオプションに対応する整数)が互換性レベルを決定する。 |
|
| |
|
| Starting with bash-4.4, Bash has begun deprecating older compatibility levels. Eventually, the options will be removed in favor of BASH_COMPAT.
| | bash-4.4から、Bashは古い互換性レベルを廃止し始めた。 最終的にはこのオプションは削除され、BASH_COMPATが使われるようになる。 |
|
| |
|
| Bash-5.0 is the final version for which there will be an individual shopt option for the previous version. Users should use BASH_COMPAT on bash-5.0 and later versions. | | Bash-5.0は、以前のバージョンに対する個別のshoptオプションが存在する最後のバージョンである。ユーザーはbash-5.0以降のバージョンでBASH_COMPATを使うべきである。 |
|
| |
|
| The following table describes the behavior changes controlled by each compatibility level setting. The compatNN tag is used as shorthand for setting the compatibility level to NN using one of the following mechanisms. For versions prior to bash-5.0, the compatibility level may be set using the corresponding compatNN shopt option. For bash-4.3 and later versions, the BASH_COMPAT variable is preferred, and it is required for bash-5.1 and later versions.
| | 以下の表は、各互換性レベルの設定によって制御される動作の変更について説明したものである。 compatNNタグは、以下のメカニズムのいずれかを使用して互換性レベルをNNに設定するための省略記法として使用される。 bash-5.0より前のバージョンでは、対応するcompatNN shoptオプションを使用して互換性レベルを設定することができる。 bash-4.3およびそれ以降のバージョンでは、BASH_COMPAT変数を使用するのが望ましく、bash-5.1およびそれ以降のバージョンでは必須である。 |
|
| |
|
| ;compat31 | | ;compat31 |
| * quoting the rhs of the [[ command's regexp matching operator (=~) has no special effect | | * コマンドの正規表現マッチング演算子(=~)のrhsを引用しても特別な効果はない。 |
|
| |
|
| ;compat32 | | ;compat32 |
| * interrupting a command list such as "a ; b ; c" causes the execution of the next command in the list (in bash-4.0 and later versions, the shell acts as if it received the interrupt, so interrupting one command in a list aborts the execution of the entire list) | | * "a ; b ; c "のようなコマンドリストに割り込むと、リスト内の次のコマンドが実行される(bash-4.0以降のバージョンでは、シェルは割り込みを受け取ったかのように動作するため、リスト内の1つのコマンドに割り込むと、リスト全体の実行が中断される)。 |
|
| |
|
| ;compat40 | | ;compat40 |
| * the < and > operators to the [[ command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII collation and strcmp(3); bash-4.1 and later use the current locale's collation sequence and strcoll(3). | | * コマンドの < と > 演算子は、文字列を比較するときに現在のロケールを考慮しない。 bash-4.1以前のバージョンでは、ASCII照合順序と[https://manpages.debian.org/unstable/manpages-dev/strcmp.3.en.html strcmp](3)を使用する。bash-4.1以降では、現在のロケールの照合順序と[https://manpages.debian.org/unstable/manpages-dev/strcoll.3.en.html strcoll](3)を使用する。 |
|
| |
|
| ;compat41 | | ;compat41 |
| * in posix mode, time may be followed by options and still be recognized as a reserved word (this is POSIX interpretation 267) | | * posixモードでは、timeの後にオプションを付けても予約語として認識される(これはPOSIX解釈267)。 |
| * in posix mode, the parser requires that an even number of single quotes occur in the word portion of a double-quoted parameter expansion and treats them specially, so that characters within the single quotes are considered quoted (this is POSIX interpretation 221) | | * posix モードでは、パーサーは二重引用符で囲まれたパラメータ展開の単語部分に偶数の一重引用符があることを要求し、一重引用符内の文字が引用符で囲まれたとみなされるように、それらを特別に扱う(これは POSIX 解釈 221 である)。 |
|
| |
|
| ;compat42 | | ;compat42 |
| * the replacement string in double-quoted pattern substitution does not undergo quote removal, as it does in versions after bash-4.2 | | * 二重引用符で囲まれたパターン置換の置換文字列は、bash-4.2以降のバージョンでは引用符の削除を行わない。 |
| * in posix mode, single quotes are considered special when expanding the word portion of a double-quoted parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpretation 221); in later versions, single quotes are not special within double-quoted word expansions | | * posixモードでは、二重引用符で囲まれたパラメータ展開の単語部分を展開するとき、一重引用符は特別なものとみなされ、閉じ波括弧や他の特別な文字を引用するために使用できる(これはPOSIX解釈221の一部である)。 |
|
| |
|
| ;compat43 | | ;compat43 |
| * the shell does not print a warning message if an attempt is made to use a quoted compound assignment as an argument to declare (declare -a foo='(1 2)'). Later versions warn that this usage is deprecated | | * シェルは、引用符で囲まれた複合代入をdeclareの引数として使おうとしても警告メッセージを表示しない(declare -a foo='(1 2)')。後のバージョンでは、この使い方が非推奨であることを警告する |
| * word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the shell to exit) | | * 単語展開エラーは、posixモードであっても、現在のコマンドを失敗させる非致命的エラーとみなされる(デフォルトの動作は、シェルを終了させる致命的エラーとなる)。 |
| * when executing a shell function, the loop state (while/until/etc.) is not reset, so break or continue in that function will break or continue loops in the calling context. Bash-4.4 and later reset the loop state to prevent this | | * シェル関数を実行するとき、ループ状態(while/until/etc)はリセットされないため、その関数内でbreakやcontinueを行うと、呼び出し元のコンテキストでループが解除されたり継続されたりする。Bash-4.4以降では、ループ状態をリセットしてこれを防いでいる。 |
|
| |
|
| ;compat44 | | ;compat44 |
| * the shell sets up the values used by BASH_ARGV and BASH_ARGC so they can expand to the shell's positional parameters even if extended debugging mode is not enabled | | * シェルがBASH_ARGVとBASH_ARGCで使用する値を設定し、拡張デバッグモードが有効になっていなくても、シェルの位置パラメーターに展開できるようにする。 |
| * a subshell inherits loops from its parent context, so break or continue will cause the subshell to exit. Bash-5.0 and later reset the loop state to prevent the exit | | * サブシェルは親コンテキストからループを継承するため、breakやcontinueはサブシェルを終了させる。 Bash-5.0以降では、ループ状態をリセットして終了を防止する。 |
| *variable assignments preceding builtins like export and readonly that set attributes continue to affect variables with the same name in the calling environment even if the shell is not in posix mode | | *シェルがposixモードでなくても、exportやreadonlyのような属性を設定する組み込み関数に先行する変数代入は、呼び出し環境の同じ名前の変数に影響を与え続ける。 |
|
| |
|
| ;compat50 | | ;compat50 |
| * Bash-5.1 changed the way $RANDOM is generated to introduce slightly more randomness. If the shell compatibility level is set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to RANDOM will produce the same sequence as in bash-5.0 | | * Bash-5.1では、$RANDOMの生成方法が変更され、若干ランダム性が増した。 シェルの互換性レベルが50以下に設定されている場合、bash-5.0とそれ以前のバージョンの方法に戻るので、RANDOMに値を代入して乱数ジェネレーターをシードすると、bash-5.0と同じシーケンスが生成される。 |
| * If the command hash table is empty, bash versions prior to bash-5.1 printed an informational message to that effect, even when producing output that can be reused as input. Bash-5.1 suppresses that message when the -l option is supplied. | | * コマンド・ハッシュ・テーブルが空の場合、bash-5.1より前のバージョンのbashでは、入力として再利用できる出力を生成する場合でも、その旨の情報メッセージが表示された。Bash-5.1では、-lオプションが指定されると、このメッセージが表示されなくなる。 |
|
| |
|
| == RESTRICTED SHELL == | | == RESTRICTED SHELL == |