|
|
(29 intermediate revisions by the same user not shown) |
Line 99: |
Line 99: |
|
| |
|
| === Double Quotes === | | === Double Quotes === |
| Enclosing characters within double quotes preserves the literal meaning of all characters except dol‐
| | 二重引用符で文字を囲むと、ドル記号($)、バッククォート(`)、バックスラッシュ( \)以外のすべての文字の文字通りの意味が保たれる。 二重引用符で囲まれたバックスラッシュは、歴史的に見ると 次の文字だけを引用するためのものである: |
| larsign ($), backquote (`), and backslash (\). The backslash inside double quotes is historically
| | :$ ` " \ <newline>. |
| weird, and serves to quote only the following characters:
| | それ以外はリテラルである。 |
| $ ` " \ <newline>.
| |
| Otherwise it remains literal.
| |
|
| |
|
| === Reserved Words === | | === Reserved Words === |
| Reserved words are words that have special meaning to the shell and are recognized at the beginning of
| | 予約語とは、シェルにとって特別な意味を持つ言葉で、行頭や制御演算子の後に認識される。 以下は予約語である: |
| a line and after a control operator. The following are reserved words:
| | |
|
| |
|
| ! elif fi while case | | ! elif fi while case |
Line 113: |
Line 111: |
| do done until if esac | | do done until if esac |
|
| |
|
| Their meaning is discussed later.
| | |
| | その意味については後述する。 |
|
| |
|
| === Aliases === | | === Aliases === |
| An alias is a name and corresponding value set using the alias(1) builtin command. Whenever a re‐
| | エイリアスは、'''[[/usr/bin/alias|alias]]''' 組み込みコマンドを使用して設定された名前と対応する値である。 予約語が発生する可能性がある場合(上記参照)、予約語をチェックした後、シェルはその語がエイリアスに一致するかどうかをチェックする。 もし一致すれば、入力ストリーム中のそれをその値で置き換える。 例えば、"ls -F" という値を持つ "lf" というエイリアスがある場合、入力は次のようになる: |
| served word may occur (see above), and after checking for reserved words, the shell checks the word to
| |
| see if it matches an alias. If it does, it replaces it in the input stream with its value. For exam‐
| |
| ple, if there is an alias called “lf” with the value “ls -F”, then the input:
| |
|
| |
|
| lf foobar ⟨return⟩
| | lf foobar ⟨return⟩ |
|
| |
|
| would become
| | は次のようになる。 |
|
| |
|
| ls -F foobar ⟨return⟩
| | ls -F foobar ⟨return⟩ |
|
| |
|
| Aliases provide a convenient way for naive users to create shorthands for commands without having to
| | エイリアスは、素朴なユーザーが引数を持つ関数の作成方法を学ぶことなく、コマンドのショートサンドを作成するための便利な方法を提供する。 また、字句的にわかりにくいコードを作成する。 |
| learn how to create functions with arguments. They can also be used to create lexically obscure code.
| |
| This use is discouraged.
| |
|
| |
|
| === Commands === | | === Commands === |
| The shell interprets the words it reads according to a language, the specification of which is outside
| | シェルは読み取った単語を言語に従って解釈するが、その仕様はこの man ページの範囲外である (POSIX 1003.2 文書の BNF を参照すること)。 しかし、基本的には、行を読み、その行の最初の単語(または制御演算子の後)が予約語でなければ、シェルは単純なコマンドを認識する。 |
| the scope of this man page (refer to the BNF in the POSIX 1003.2 document). Essentially though, a
| | そうでない場合は、複雑なコマンドや他の特殊な構成が認識された可能性がある。 |
| line is read and if the first word of the line (or after a control operator) is not a reserved word,
| |
| then the shell has recognized a simple command. Otherwise, a complex command or some other special
| |
| construct may have been recognized.
| |
|
| |
|
| === Simple Commands === | | === Simple Commands === |
Line 146: |
Line 137: |
|
| |
|
| === Redirections === | | === Redirections === |
| Redirections are used to change where a command reads its input or sends its output. In general,
| | リダイレクションは、コマンドが入力を読み取る場所や出力を送信する場所を変更するために使用する。 一般的には、次のようになる。 |
| redirections open, close, or duplicate an existing reference to a file. The overall format used for
| | リダイレクションは、ファイルへの既存の参照を開いたり閉じたり、複製したりする。 リダイレクトに使用される全体的な形式は |
| redirection is:
| | リダイレクトに使用される全体的な形式は次のとおりである: |
|
| |
|
| [n] redir-op file
| | :[n] redir-op file |
|
| |
|
| where redir-op is one of the redirection operators mentioned previously. Following is a list of the
| | ここで、redir-opは前述のリダイレクト演算子の1つである。 以下は、可能なリダイレクションのリストである。 |
| possible redirections. The [n] is an optional number between 0 and 9, as in ‘3’ (not ‘[3]’), that
| | 可能なリダイレクションのリストである。 [n]は0から9までの任意の数字で、'3'('[3]'ではない)のように、ファイルディスクリプタを参照するものである。 |
| refers to a file descriptor.
| |
|
| |
|
| [n]> file Redirect standard output (or n) to file.
| | :[n]> file Redirect standard output (or n) to file. |
|
| |
|
| [n]>| file Same, but override the -C option.
| | :[n]>| file Same, but override the -C option. |
|
| |
|
| [n]>> file Append standard output (or n) to file.
| | :[n]>> file Append standard output (or n) to file. |
|
| |
|
| [n]< file Redirect standard input (or n) from file.
| | :[n]< file Redirect standard input (or n) from file. |
|
| |
|
| [n1]<&n2 Copy file descriptor n2 as stdout (or fd n1). fd n2.
| | :[n1]<&n2 Copy file descriptor n2 as stdout (or fd n1). fd n2. |
|
| |
|
| [n]<&- Close standard input (or n).
| | :[n]<&- Close standard input (or n). |
|
| |
|
| [n1]>&n2 Copy file descriptor n2 as stdin (or fd n1). fd n2.
| | :[n1]>&n2 Copy file descriptor n2 as stdin (or fd n1). fd n2. |
|
| |
|
| [n]>&- Close standard output (or n).
| | :[n]>&- Close standard output (or n). |
|
| |
|
| [n]<> file Open file for reading and writing on standard input (or n).
| | :[n]<> file Open file for reading and writing on standard input (or n). |
|
| |
|
| The following redirection is often called a “here-document”.
| | 以下のようなリダイレクトを「here-document」と呼ぶことがある。 |
|
| |
|
| [n]<< delimiter
| | :[n]<< delimiter |
| here-doc-text ...
| | ::here-doc-text ... |
| delimiter
| | :delimiter |
|
| |
|
| All the text on successive lines up to the delimiter is saved away and made available to the command
| | 区切り文字までの連続した行のテキストはすべて保存され、標準入力、またはファイルディスクリプタnが指定されている場合は、そのコマンドで利用できるようになる。 最初の行で指定された区切り文字が引用符で囲まれている場合、here-doc-textは文字通りに扱われる。それ以外の場合は,パラメータ展開,コマンド置換,算術展開(「展開」の項を参照)が行われる.“Expansions”のセクションで説明されている)。 演算子が"<<"でなく"<<-"の場合、here-doc-textの先頭のタブは取り除かれる。 |
| on standard input, or file descriptor n if it is specified. If the delimiter as specified on the ini‐
| |
| tial line is quoted, then the here-doc-text is treated literally, otherwise the text is subjected to
| |
| parameter expansion, command substitution, and arithmetic expansion (as described in the section on
| |
| “Expansions”). If the operator is “<<-” instead of “<<”, then leading tabs in the here-doc-text are
| |
| stripped.
| |
|
| |
|
| === Search and Execution === | | === Search and Execution === |
| There are three types of commands: shell functions, builtin commands, and normal programs – and the
| | コマンドには、シェル関数、組み込みコマンド、通常のプログラムの3種類があり、この順番でコマンドを(名前で)検索する。 それぞれ異なる方法で実行される。 |
| command is searched for (by name) in that order. They each are executed in a different way.
| |
|
| |
|
| When a shell function is executed, all of the shell positional parameters (except $0, which remains
| | シェル関数が実行されると、シェルの位置パラメーターはすべて(変更されない$0を除く)シェル関数の引数に設定される。 コマンドの環境に明示的に置かれた変数(関数名の前に変数への代入を置く)は、その関数のローカルとなり、与えられた値に設定される。 次に,関数定義で与えられたコマンドが実行される. コマンドの実行が完了すると、位置パラメータは元の値に戻される. これはすべて現在のシェル内で行われる。 |
| unchanged) are set to the arguments of the shell function. The variables which are explicitly placed
| |
| in the environment of the command (by placing assignments to them before the function name) are made
| |
| local to the function and are set to the values given. Then the command given in the function defini‐
| |
| tion is executed. The positional parameters are restored to their original values when the command
| |
| completes. This all occurs within the current shell.
| |
|
| |
|
| Shell builtins are executed internally to the shell, without spawning a new process.
| | シェルのビルトインは、新しいプロセスを生成することなく,シェルの内部で実行される。 |
|
| |
|
| Otherwise, if the command name doesn't match a function or builtin, the command is searched for as a
| | それ以外の場合、コマンド名が関数やビルトインにマッチしない場合、コマンドはファイルシステム内の通常のプログラムとして検索される(次のセクションで説明する)。 通常のプログラムが実行されると、シェルは引数や環境をプログラムに渡して実行する。 プログラムが通常の実行可能なファイルでない場合(すなわち、ASCII表現が "#!"である「マジックナンバー」で始まらないので、''[https://manpages.debian.org/testing/manpages-dev/execve.2.en.html execve]''(2)がENOEXECを返す場合)、シェルは子シェルでプログラムを解釈することになる。 この場合、子シェルはそれ自体を再初期化するので、親シェルにあるハッシュ化されたコマンドの位置が子シェルによって記憶されることを除いて、アドホックなシェルスクリプトを扱うために新しいシェルが起動されたかのような効果がある。 |
| normal program in the file system (as described in the next section). When a normal program is exe‐
| |
| cuted, the shell runs the program, passing the arguments and the environment to the program. If the
| |
| program is not a normal executable file (i.e., if it does not begin with the "magic number" whose
| |
| ASCII representation is "#!", so execve(2) returns ENOEXEC then) the shell will interpret the program
| |
| in a subshell. The child shell will reinitialize itself in this case, so that the effect will be as
| |
| if a new shell had been invoked to handle the ad-hoc shell script, except that the location of hashed
| |
| commands located in the parent shell will be remembered by the child.
| |
|
| |
|
| Note that previous versions of this document and the source code itself misleadingly and sporadically
| | この文書の以前のバージョンとソースコード自体は、マジックナンバーのないシェルスクリプトを「シェルプロシージャ」と誤解を招くような散発的な表現をしていることに注意されたい。 |
| refer to a shell script without a magic number as a "shell procedure".
| |
|
| |
|
| === Path Search === | | === Path Search === |
| When locating a command, the shell first looks to see if it has a shell function by that name. Then
| | コマンドを探すとき、シェルはまずその名前のシェル関数があるかどうかを確認する。 そして、その名前の組み込みコマンドを探す。 組み込みコマンドが見つからない場合、2つのうちの1つが起こる: |
| it looks for a builtin command by that name. If a builtin command is not found, one of two things
| |
| happen:
| |
|
| |
|
| 1. Command names containing a slash are simply executed without performing any searches.
| | # スラッシュを含むコマンド名は、検索を行わず単に実行される。 |
| | | # シェルはPATHの各エントリを順番に検索して、コマンドを探す。 PATH変数の値は,コロンで区切られた一連のエントリであるべきである。 各エントリは,ディレクトリ名で構成される。 カレントディレクトリは,空のディレクトリ名で暗黙的に,またはピリオド1つで明示的に示すことができる。 |
| 2. The shell searches each entry in PATH in turn for the command. The value of the PATH variable
| |
| should be a series of entries separated by colons. Each entry consists of a directory name. The
| |
| current directory may be indicated implicitly by an empty directory name, or explicitly by a sin‐
| |
| gle period.
| |
|
| |
|
| === Command Exit Status === | | === Command Exit Status === |
| Each command has an exit status that can influence the behaviour of other shell commands. The para‐
| | 各コマンドには、他のシェルコマンドの動作に影響を与えることができる終了ステータスがある。 パラダイムは、コマンドが正常または成功した場合はゼロで終了し、失敗、エラー、または誤った指示の場合はゼロ以外で終了することである。 各コマンドのマニュアルページには、さまざまな終了コードとその意味が記載されているはずである。 さらに、組み込みのコマンドは、実行されたシェル関数と同様に、終了コードを返す。 |
| digm is that a command exits with zero for normal or success, and non-zero for failure, error, or a
| |
| false indication. The man page for each command should indicate the various exit codes and what they
| |
| mean. Additionally, the builtin commands return exit codes, as does an executed shell function.
| |
|
| |
|
| If a command consists entirely of variable assignments then the exit status of the command is that of
| | コマンドが完全に変数代入で構成されている場合、コマンドの終了ステータスは、もしあれば最後のコマンド代入のものであり、そうでなければ0である。 |
| the last command substitution if any, otherwise 0.
| |
|
| |
|
| === Complex Commands === | | === Complex Commands === |
| Complex commands are combinations of simple commands with control operators or reserved words, to‐
| | 複雑なコマンドは、単純なコマンドと制御演算子や予約語の組み合わせで、より大きな複雑なコマンドを作成する。 より一般的には、コマンドは次のいずれかに該当する: |
| gether creating a larger complex command. More generally, a command is one of the following:
| |
|
| |
|
| • simple command
| | • simple command |
|
| |
|
| • pipeline
| | • pipeline |
|
| |
|
| • list or compound-list
| | • list or compound-list |
|
| |
|
| • compound command
| | • compound command |
|
| |
|
| • function definition
| | • function definition |
|
| |
|
| Unless otherwise stated, the exit status of a command is that of the last simple command executed by
| | 特に断りのない限り、コマンドの終了状態は、そのコマンドが最後に実行した単純なコマンドの終了状態である。 |
| the command.
| |
|
| |
|
| === Pipelines === | | === Pipelines === |
| A pipeline is a sequence of one or more commands separated by the control operator |. The standard
| | パイプラインは、制御演算子|で区切られた1つ以上のコマンドのシーケンスである。 最後のコマンド以外のすべての標準出力は、次のコマンドの標準入力に接続される。 最後のコマンドの標準出力は、通常通り、シェルから継承される。 |
| output of all but the last command is connected to the standard input of the next command. The stan‐
| |
| dard output of the last command is inherited from the shell, as usual.
| |
|
| |
|
| The format for a pipeline is:
| | パイプラインの形式は次の通りである: |
|
| |
|
| [!] command1 [| command2 ...]
| | [!] command1 [| command2 ...] |
|
| |
|
| The standard output of command1 is connected to the standard input of command2. The standard input,
| | コマンド1の標準出力は、コマンド2の標準入力に接続される。 コマンドの標準入力、標準出力、またはその両方は、コマンドの一部であるリダイレクト演算子によって指定されたリダイレクトの前に、パイプラインによって割り当てられたと見なされる。 |
| standard output, or both of a command is considered to be assigned by the pipeline before any redi‐
| |
| rection specified by redirection operators that are part of the command.
| |
|
| |
|
| If the pipeline is not in the background (discussed later), the shell waits for all commands to com‐
| | パイプラインがバックグラウンドにない場合(後述)、シェルはすべてのコマンドの完了を待つ。 |
| plete.
| |
|
| |
|
| If the reserved word ! does not precede the pipeline, the exit status is the exit status of the last
| | 予約語! がパイプラインの前にない場合、終了ステータスはパイプラインで指定された最後のコマンドの終了ステータスになる。 そうでない場合、終了ステータスは、最後のコマンドの終了ステータスの論理NOTとなる。 すなわち、最後のコマンドが0を返す場合、終了ステータスは1であり、最後のコマンドが0より大きい値を返す場合、終了ステータスは0である。 |
| command specified in the pipeline. Otherwise, the exit status is the logical NOT of the exit status
| |
| of the last command. That is, if the last command returns zero, the exit status is 1; if the last
| |
| command returns greater than zero, the exit status is zero.
| |
|
| |
|
| Because pipeline assignment of standard input or standard output or both takes place before redirect‐
| | 標準入力または標準出力、あるいはその両方のパイプラインの割り当ては、リダイレクトの前に行われるため、リダイレクトによって変更されることがある。 例えば、次のようになる: |
| ion, it can be modified by redirection. For example:
| |
|
| |
|
| $ command1 2>&1 | command2
| | $ command1 2>&1 | command2 |
|
| |
|
| sends both the standard output and standard error of command1 to the standard input of command2.
| | は、コマンド1の標準出力と標準エラーの両方を、コマンド2の標準入力に送信する。 |
|
| |
|
| A ; or ⟨newline⟩ terminator causes the preceding AND-OR-list (described next) to be executed sequen‐
| | または⟨ニューライン⟩の終端は、先行するAND-ORリスト(次に説明)を順次実行させる;&は先行するAND-ORリストを非同期に実行する。 |
| tially; a & causes asynchronous execution of the preceding AND-OR-list.
| |
|
| |
|
| Note that unlike some other shells, each process in the pipeline is a child of the invoking shell (un‐
| | 他のシェルとは異なり、パイプラインの各プロセスは起動したシェルの子であることに注意すること(シェルの組み込みでない場合は、現在のシェルで実行されるが、環境に与える影響はすべて消去される)。 |
| less it is a shell builtin, in which case it executes in the current shell – but any effect it has on
| |
| the environment is wiped).
| |
|
| |
|
| === Background Commands – & === | | === Background Commands – & === |
| If a command is terminated by the control operator ampersand (&), the shell executes the command asyn‐
| | コマンドが制御演算子アンパサンド(&)で終了する場合、シェルはコマンドを非同期で実行する、つまり、次のコマンドを実行する前にコマンドが終了するのを待たない。 |
| chronously – that is, the shell does not wait for the command to finish before executing the next com‐
| |
| mand.
| |
|
| |
|
| The format for running a command in background is:
| | バックグラウンドでコマンドを実行する場合の形式は以下の通りである: |
|
| |
|
| command1 & [command2 & ...]
| | command1 & [command2 & ...] |
|
| |
|
| If the shell is not interactive, the standard input of an asynchronous command is set to /dev/null.
| | シェルが対話型でない場合、非同期コマンドの標準入力は/dev/nullに設定される。 |
|
| |
|
| === Lists – Generally Speaking === | | === Lists – Generally Speaking === |
| A list is a sequence of zero or more commands separated by newlines, semicolons, or ampersands, and
| | リストは、0個以上のコマンドを改行、セミコロン、アンパサンドで区切り、オプションでこれら3つの文字のうち1つで終了させるシーケンスである。 リスト内のコマンドは,書かれた順番に実行される. コマンドの後にアンパサンドが続く場合,シェルはそのコマンドを開始し,すぐに次のコマンドに進む。それ以外の場合は,コマンドが終了するのを待ってから次のコマンドに進む。 |
| optionally terminated by one of these three characters. The commands in a list are executed in the
| |
| order they are written. If command is followed by an ampersand, the shell starts the command and im‐
| |
| mediately proceeds onto the next command; otherwise it waits for the command to terminate before pro‐
| |
| ceeding to the next one.
| |
|
| |
|
| === Short-Circuit List Operators === | | === Short-Circuit List Operators === |
| “&&” and “||” are AND-OR list operators. “&&” executes the first command, and then executes the sec‐
| | "&&"と"||"はAND-ORリスト演算子である。 "&&"は、最初のコマンドを実行し、最初のコマンドの終了ステータスがゼロの場合に限り、2番目のコマンドを実行する。 "||"も同様だが、最初のコマンドの終了ステータスがゼロでない場合にのみ、2番目のコマンドを実行する。 "&&"と"||"はどちらも同じ優先度を持つ。 |
| ond command if and only if the exit status of the first command is zero. “||” is similar, but exe‐
| |
| cutes the second command if and only if the exit status of the first command is nonzero. “&&” and
| |
| “||” both have the same priority.
| |
|
| |
|
| Flow-Control Constructs – if, while, for, case
| | フロー制御構文 - if、while、for、case |
| The syntax of the if command is
| | ifコマンドの構文は以下の通りである。 |
|
| |
|
| if list | | if list |
Line 319: |
Line 257: |
| fi | | fi |
|
| |
|
| The syntax of the while command is
| | whileコマンドの構文は以下の通りである。 |
|
| |
|
| while list | | while list |
Line 325: |
Line 263: |
| done | | done |
|
| |
|
| The two lists are executed repeatedly while the exit status of the first list is zero. The until com‐
| | 最初のリストの終了ステータスがゼロの間、2つのリストが繰り返し実行される。 untilコマンドも似ているが、whileの代わりにuntilという単語があり、最初のリストの終了ステータスがゼロになるまで繰り返される。 |
| mand is similar, but has the word until in place of while, which causes it to repeat until the exit
| |
| status of the first list is zero.
| |
|
| |
|
| The syntax of the for command is
| | forコマンドの構文は以下の通りである。 |
|
| |
|
| for variable [ in [ word ... ] ] | | for variable [ in [ word ... ] ] |
Line 335: |
Line 271: |
| done | | done |
|
| |
|
| The words following in are expanded, and then the list is executed repeatedly with the variable set to
| | inに続く単語が展開され、変数に各単語が順番にセットされた状態でリストが繰り返し実行される。 in word ...を省略すると、in "$@"と同じになる。 |
| each word in turn. Omitting in word ... is equivalent to in "$@".
| |
|
| |
|
| The syntax of the break and continue command is
| | break and continueコマンドの構文は以下の通りである。 |
|
| |
|
| break [ num ] | | break [ num ] |
| continue [ num ] | | continue [ num ] |
|
| |
|
| Break terminates the num innermost for or while loops. Continue continues with the next iteration of
| | Breakは、最も内側のforまたはwhileループを終了させる。 Continueは、最も内側のループの次の反復を続ける。 これらは組み込みコマンドとして実装されている。 |
| the innermost loop. These are implemented as builtin commands.
| |
|
| |
|
| The syntax of the case command is
| | caseコマンドの構文は以下の通りである。 |
|
| |
|
| case word in | | case word in |
Line 353: |
Line 287: |
| esac | | esac |
|
| |
|
| The pattern can actually be one or more patterns (see Shell Patterns described later), separated by
| | パターンは実際には1つ以上のパターン(後述のシェルパターンを参照)にすることができ、"|"文字で区切られる。 パターンの前の"("文字はオプションである。 |
| “|” characters. The “(” character before the pattern is optional.
| |
|
| |
|
| Grouping Commands Together
| | コマンドをグループ化する |
| Commands may be grouped by writing either
| | |
| | コマンドは |
|
| |
|
| (list) | | (list) |
Line 365: |
Line 299: |
| { list; } | | { list; } |
|
| |
|
| The first of these executes the commands in a subshell. Builtin commands grouped into a (list) will
| | これらのうち最初のものは、サブシェル内のコマンドを実行する。 (リスト)にグループ化された組み込みコマンドは、現在のシェルに影響を与えない。 2番目の形式は、別のシェルをフォークしないので、少し効率的である。 このようにコマンドをグループ化することで、あたかも1つのプログラムであるかのように出力をリダイレクトすることができる: |
| not affect the current shell. The second form does not fork another shell so is slightly more effi‐
| |
| cient. Grouping commands together this way allows you to redirect their output as though they were
| |
| one program:
| |
|
| |
|
| { printf " hello " ; printf " world\n" ; } > greeting | | { printf " hello " ; printf " world\n" ; } > greeting |
|
| |
|
| Note that “}” must follow a control operator (here, “;”) so that it is recognized as a reserved word
| | 他のコマンド引数としてではなく、予約語として認識されるように、"}"は制御演算子(ここでは";")の後に続かなければならないことに注意。 |
| and not as another command argument.
| | |
| | 関数 |
|
| |
|
| Functions
| | 関数定義の構文は以下の通りである。 |
| The syntax of a function definition is
| |
|
| |
|
| name () command | | name () command |
|
| |
|
| A function definition is an executable statement; when executed it installs a function named name and
| | 実行されると、nameという名前の関数がインストールされ、終了ステータスはゼロを返す。 コマンドは通常、"{"と"}"で囲まれたリストである。 |
| returns an exit status of zero. The command is normally a list enclosed between “{” and “}”.
| |
|
| |
|
| Variables may be declared to be local to a function by using a local command. This should appear as
| | 変数は、localコマンドを使用することで、関数に対してlocalであることを宣言することができる。 これは関数の最初のステートメントとして記述する。 |
| the first statement of a function, and the syntax is
| |
|
| |
|
| local [variable | -] ... | | local [variable | -] ... |
|
| |
|
| Local is implemented as a builtin command.
| | localは組み込みコマンドとして実装されている。 |
|
| |
|
| When a variable is made local, it inherits the initial value and exported and readonly flags from the
| | 変数をlocalにすると、その変数の初期値、エクスポートとリードオンリーのフラグを、周囲のスコープに同じ名前の変数があれば、その変数から継承する。 そうでない場合、変数は初期値として設定されない。 シェルは動的スコープを使用するため、変数xを関数fのlocalにし、その関数fが関数gを呼び出した場合、gの内部で作成された変数xへの参照は、xという名前のグローバル変数ではなく、fの内部で宣言された変数xを参照することになる。 |
| variable with the same name in the surrounding scope, if there is one. Otherwise, the variable is
| |
| initially unset. The shell uses dynamic scoping, so that if you make the variable x local to function
| |
| f, which then calls function g, references to the variable x made inside g will refer to the variable
| |
| x declared inside f, not to the global variable named x.
| |
|
| |
|
| The only special parameter that can be made local is “-”. Making “-” local any shell options that are
| | localにできる唯一の特別なパラメーターは"-"である。 localに"-"を指定すると、関数内でsetコマンドによって変更されたシェル・オプションは、関数が戻ったときに元の値に戻される。 |
| changed via the set command inside the function to be restored to their original values when the func‐
| |
| tion returns.
| |
|
| |
|
| The syntax of the return command is
| | returnコマンドの構文は以下の通りである。 |
|
| |
|
| return [exitstatus] | | return [exitstatus] |
|
| |
|
| It terminates the currently executing function. Return is implemented as a builtin command.
| | 現在実行中の関数を終了させる。 returnは組み込みコマンドとして実装されている。 |
|
| |
|
| === Variables and Parameters === | | === Variables and Parameters === |
| The shell maintains a set of parameters. A parameter denoted by a name is called a variable. When
| | シェルはパラメーターのセットを保持する。 名前で示されるパラメータは変数と呼ばれる。 起動時、シェルはすべての環境変数をシェル変数に変える。 新しい変数は |
| starting up, the shell turns all the environment variables into shell variables. New variables can be
| |
| set using the form
| |
|
| |
|
| name=value | | name=value |
|
| |
|
| Variables set by the user must have a name consisting solely of alphabetics, numerics, and underscores
| | ユーザーによって設定される変数は、アルファベット、数字、アンダースコアからなる名前でなければならない。 パラメータは、以下に説明するように、数字や特殊文字で表すこともできる。 |
| - the first of which must not be numeric. A parameter can also be denoted by a number or a special
| |
| character as explained below.
| |
|
| |
|
| === Positional Parameters === | | === Positional Parameters === |
| A positional parameter is a parameter denoted by a number (n > 0). The shell sets these initially to
| | 位置パラメーターは、数字(n > 0)で示されるパラメーターである。 シェルはこれらを、シェルスクリプトの名前に続くコマンドライン引数の値に初期設定する。 set 組み込み関数を使用して、これらを設定またはリセットすることもできる。 |
| the values of its command line arguments that follow the name of the shell script. The set builtin
| |
| can also be used to set or reset them.
| |
|
| |
|
| === Special Parameters === | | === Special Parameters === |
| A special parameter is a parameter denoted by one of the following special characters. The value of
| | 特殊パラメータは、以下の特殊文字のいずれかで示されるパラメータである。 パラメータの値は、その文字の横に記載されている。 |
| the parameter is listed next to its character.
| |
|
| |
|
| * Expands to the positional parameters, starting from one. When the expansion occurs
| | ;* |
| within a double-quoted string it expands to a single field with the value of each parame‐
| | :位置パラメータを1から順に展開する。 展開が二重引用符で囲まれた文字列の中で行われる場合、各パラメータの値が IFS変数の最初の文字で区切られた1つのフィールドに展開され、IFSが設定されていない場合は ⟨スペース⟩で区切られる。 |
| ter separated by the first character of the IFS variable, or by a ⟨space⟩ if IFS is un‐
| |
| set.
| |
|
| |
|
| @ Expands to the positional parameters, starting from one. When the expansion occurs
| | ;@ |
| within double-quotes, each positional parameter expands as a separate argument. If there
| | :位置パラメータを1から順に展開する。 展開が二重引用符で囲まれている場合、各位置パラメータは別々の引数として展開される。 位置パラメーターがない場合、@が二重引用符で囲まれていても、@の展開は0個の引数を生成する。 これが基本的に意味するのは、例えば$1が "abc "で$2が "def ghi "の場合、"$@"は2つの引数に展開されるということである: |
| are no positional parameters, the expansion of @ generates zero arguments, even when @ is
| |
| double-quoted. What this basically means, for example, is if $1 is “abc” and $2 is “def
| |
| ghi”, then "$@" expands to the two arguments:
| |
|
| |
|
| "abc" "def ghi"
| | ::<nowiki>"abc" "def ghi"</nowiki> |
|
| |
|
| # Expands to the number of positional parameters.
| | ;# |
| | :位置パラメーターの数に拡張する。 |
|
| |
|
| ? Expands to the exit status of the most recent pipeline.
| | ;? |
| | :直近のパイプラインの終了ステータスに展開する。 |
|
| |
|
| - (Hyphen.) Expands to the current option flags (the single-letter option names concatenated into a
| | ;- (Hyphen.) |
| string) as specified on invocation, by the set builtin command, or implicitly by the
| | :起動時、set 組み込みコマンド、またはシェルによって暗黙的に指定された、現在のオプションフラグ(1文字のオプション名を連結した文字列)に展開する。 |
| shell.
| |
|
| |
|
| $ Expands to the process ID of the invoked shell. A subshell retains the same value of $
| | ;$ |
| as its parent.
| | :呼び出されたシェルのプロセス ID に展開される。 サブシェルは、親と同じ $ の値を保持する。 |
|
| |
|
| ! Expands to the process ID of the most recent background command executed from the current
| | ;! |
| shell. For a pipeline, the process ID is that of the last command in the pipeline.
| | :現在のシェルから実行された最新のバックグラウンド・コマンドのプロセスIDに展開される。 パイプラインの場合、プロセスIDはパイプラインの最後のコマンドのものになる。 |
|
| |
|
| 0 (Zero.) Expands to the name of the shell or shell script.
| | ;0 (Zero.) |
| | :シェルまたはシェルスクリプトの名前に展開する。 |
|
| |
|
| === Word Expansions === | | === Word Expansions === |
| This clause describes the various expansions that are performed on words. Not all expansions are per‐
| | この節では、単語に対して行われる様々な展開について説明する。 後述するように、すべての展開がすべての単語に対して行われるわけではない。 |
| formed on every word, as explained later.
| | 後述するように、すべての単語に適用されるわけではない。 |
| | |
| Tilde expansions, parameter expansions, command substitutions, arithmetic expansions, and quote re‐
| |
| movals that occur within a single word expand to a single field. It is only field splitting or path‐
| |
| name expansion that can create multiple fields from a single word. The single exception to this rule
| |
| is the expansion of the special parameter @ within double-quotes, as was described above.
| |
|
| |
|
| The order of word expansion is:
| | チルダ展開、パラメータ展開、コマンド置換、算術展開、引用符除去のうち、1つの単語内で行われるものは、1つのフィールドに展開される。 一つの単語から複数のフィールドを作ることができるのは、フィールドの分割かパス名の展開だけである。 このルールの唯一の例外は、上で説明したように、ダブルクォート内での特殊パラメータ@の展開である。 |
|
| |
|
| 1. Tilde Expansion, Parameter Expansion, Command Substitution, Arithmetic Expansion (these all occur
| | 単語展開の順序は以下の通りである: |
| at the same time).
| |
|
| |
|
| 2. Field Splitting is performed on fields generated by step (1) unless the IFS variable is null.
| | #チルダ展開、パラメータ展開、コマンド置換、算術展開(これらはすべて同時に行われる)。 |
| | #フィールド分割は、IFS変数がNULLでない限り、ステップ(1)で生成されたフィールドに対して行われる。 |
| | #パス名展開(set -fが有効な場合を除く)。 |
| | #引用符の除去。 |
|
| |
|
| 3. Pathname Expansion (unless set -f is in effect).
| | 文字は、パラメータ展開、コマンド置換、または算術評価の導入に使用される。 |
|
| |
|
| 4. Quote Removal.
| | チルダ展開(ユーザーのホームディレクトリを置換する)。 |
| | | 引用符で囲まれていないチルダ文字(~)で始まる単語は、チルダ展開の対象となる。 スラッシュ(/)または語尾までのすべての文字がユーザー名として扱われ、そのユーザーのホームディレクトリに置き換えられる。 ユーザー名がない場合(~/foobarのように)、チルダはHOME変数の値(現在のユーザーのホームディレクトリ)に置き換えられる。 |
| The $ character is used to introduce parameter expansion, command substitution, or arithmetic evalua‐
| |
| tion.
| |
| | |
| Tilde Expansion (substituting a user's home directory)
| |
| A word beginning with an unquoted tilde character (~) is subjected to tilde expansion. All the char‐
| |
| acters up to a slash (/) or the end of the word are treated as a username and are replaced with the
| |
| user's home directory. If the username is missing (as in ~/foobar), the tilde is replaced with the
| |
| value of the HOME variable (the current user's home directory).
| |
|
| |
|
| === Parameter Expansion === | | === Parameter Expansion === |
| The format for parameter expansion is as follows:
| | パラメータ展開のフォーマットは以下の通りである: |
|
| |
|
| ${expression} | | ${expression} |
|
| |
|
| where expression consists of all characters until the matching “}”. Any “}” escaped by a backslash or
| | 式は、マッチする"}"までのすべての文字で構成される。 バックスラッシュでエスケープされた"}"、または引用符で囲まれた文字列内の"}"、および 埋め込み算術展開、コマンド置換、変数展開の文字は、マッチする"}"を決定する際には検査されない。 |
| within a quoted string, and characters in embedded arithmetic expansions, command substitutions, and
| |
| variable expansions, are not examined in determining the matching “}”.
| |
|
| |
|
| The simplest form for parameter expansion is:
| | パラメータ展開の最も単純な形式は以下のとおりである: |
|
| |
|
| ${parameter} | | ${parameter} |
|
| |
|
| The value, if any, of parameter is substituted.
| | パラメータの値があれば、その値が代入される。 |
|
| |
|
| The parameter name or symbol can be enclosed in braces, which are optional except for positional pa‐
| | パラメータ名または記号は中括弧で囲むことができる。中括弧は、1桁以上の位置パラメー タや、パラメータの後に名前の一部として解釈される文字が続く場合を除き、省略可能である。 パラメータ展開が二重引用符で囲まれている場合、そのパラメータは中括弧で囲むことができる: |
| rameters with more than one digit or when parameter is followed by a character that could be inter‐
| |
| preted as part of the name. If a parameter expansion occurs inside double-quotes:
| |
|
| |
|
| 1. Pathname expansion is not performed on the results of the expansion.
| | #パス名展開は展開結果に対して行われない。 |
| | #フィールド分割は、@を除いて、展開結果に対して実行されない。 |
|
| |
|
| 2. Field splitting is not performed on the results of the expansion, with the exception of @.
| | さらに、以下の書式のいずれかを使用することで、パラメータ展開を変更することができる。 |
|
| |
|
| In addition, a parameter expansion can be modified by using one of the following formats.
| | ;<nowiki>${parameter:-word}</nowiki> |
| | :デフォルト値を使用する。 パラメータが未設定またはNULLの場合、wordの展開が代入され、そうでない場合、パラメータの値が代入される。 |
|
| |
|
| ${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is
| | ;<nowiki>${parameter:=word}</nowiki> |
| substituted; otherwise, the value of parameter is substituted.
| | :デフォルト値を割り当てる。 パラメータが未設定または NULL の場合、単語の展開がパラメータに代入される。 すべての場合において、パラメータの最終値が代入される。 この方法で代入できるのは変数のみで、位置パラメーターや特殊パラメーターは代入できない。 |
|
| |
|
| ${parameter:=word} Assign Default Values. If parameter is unset or null, the expansion of word is
| | ;<nowiki>${parameter:?[word]}</nowiki> |
| assigned to parameter. In all cases, the final value of parameter is substi‐
| | :Nullまたは未設定の場合、エラーを表示する。 パラメータが未設定またはNULLの場合、wordの展開(wordが省略された場合は未設定であることを示すメッセージ)が標準エラーに書き込まれ、シェルは0以外の終了ステータスで終了する。 そうでなければ、パラメータの値が代入される。 対話型シェルは終了する必要はない。 |
| tuted. Only variables, not positional parameters or special parameters, can be
| |
| assigned in this way.
| |
|
| |
|
| ${parameter:?[word]} Indicate Error if Null or Unset. If parameter is unset or null, the expansion
| | ;<nowiki>${parameter:+word}</nowiki> |
| of word (or a message indicating it is unset if word is omitted) is written to
| | :代替値を使用する。 パラメータが未設定またはNULLの場合、NULLが代入され、そうでない場合、単語の展開が代入される。 |
| standard error and the shell exits with a nonzero exit status. Otherwise, the
| |
| value of parameter is substituted. An interactive shell need not exit.
| |
|
| |
|
| ${parameter:+word} Use Alternative Value. If parameter is unset or null, null is substituted; oth‐
| | :先に示したパラメータ展開では、書式にコロンを使用すると、パラメータが未設定またはNULLであるかどうかをテストすることになる。 |
| erwise, the expansion of word is substituted.
| |
|
| |
|
| In the parameter expansions shown previously, use of the colon in the format results in a test for a
| | ;<nowiki>${#parameter}</nowiki> |
| parameter that is unset or null; omission of the colon results in a test for a parameter that is only
| | :文字列の長さ。 パラメータ値の文字数。 |
| unset.
| |
|
| |
|
| ${#parameter} String Length. The length in characters of the value of parameter.
| | 以下の4種類のパラメータ拡張は、部分文字列処理を提供する。 いずれの場合も、パターンの評価には正規表現表記ではなく、パターンマッチング表記(シェルパターン参照)が使われる。 パラメータが*または@の場合、展開結果は不定である。 パラメータ展開文字列全体を二重引用符で囲むと、次の4種類のパターン文字は引用符で囲まれないが、中括弧内の文字は引用符で囲まれる。 |
|
| |
|
| The following four varieties of parameter expansion provide for substring processing. In each case,
| | ;<nowiki>${parameter%word}</nowiki> |
| pattern matching notation (see Shell Patterns), rather than regular expression notation, is used to
| | :最小接尾辞パターンを取り除く。 単語を展開してパターンを生成する。 パラメータ展開の結果、パターンにマッチする接尾辞の最小部分が削除されたパラメータが得られる。 |
| evaluate the patterns. If parameter is * or @, the result of the expansion is unspecified. Enclosing
| |
| the full parameter expansion string in double-quotes does not cause the following four varieties of
| |
| pattern characters to be quoted, whereas quoting characters within the braces has this effect.
| |
|
| |
|
| ${parameter%word} Remove Smallest Suffix Pattern. The word is expanded to produce a pattern. The
| | ;<nowiki>${parameter%%word}</nowiki> |
| parameter expansion then results in parameter, with the smallest portion of the
| | :最大の接尾辞パターンを取り除く。 単語を展開してパターンを生成する。 そして、パラメータ展開の結果、パターンにマッチする接尾辞の最大部分が削除されたパラメータが生成される。 |
| suffix matched by the pattern deleted.
| |
|
| |
|
| ${parameter%%word} Remove Largest Suffix Pattern. The word is expanded to produce a pattern. The
| | ;<nowiki>${parameter#word}</nowiki> |
| parameter expansion then results in parameter, with the largest portion of the
| | :最小の接頭辞パターンを取り除く。 単語を展開してパターンを生成する。 パラメータ展開の結果、パターンにマッチする接頭辞の最小部分が削除されたパラメータが得られる。 |
| suffix matched by the pattern deleted.
| |
|
| |
|
| ${parameter#word} Remove Smallest Prefix Pattern. The word is expanded to produce a pattern. The
| | ;<nowiki>${parameter##word}</nowiki> |
| parameter expansion then results in parameter, with the smallest portion of the
| | :最大の接頭辞パターンを取り除く。 単語を展開してパターンを生成する。 パラメータ展開の結果、パターンにマッチする接頭辞の最大部分が削除されたパラメータが得られる。 |
| prefix matched by the pattern deleted.
| |
| | |
| ${parameter##word} Remove Largest Prefix Pattern. The word is expanded to produce a pattern. The
| |
| parameter expansion then results in parameter, with the largest portion of the
| |
| prefix matched by the pattern deleted.
| |
|
| |
|
| === Command Substitution === | | === Command Substitution === |
| Command substitution allows the output of a command to be substituted in place of the command name it‐
| | コマンド置換では、コマンド名の代わりにコマンドの出力を置換することができる。 コマンド置換は、コマンドが以下のように囲まれているときに行われる: |
| self. Command substitution occurs when the command is enclosed as follows:
| |
|
| |
|
| $(command) | | $(command) |
Line 563: |
Line 446: |
| `command` | | `command` |
|
| |
|
| The shell expands the command substitution by executing command in a subshell environment and replac‐
| | シェルは、サブシェル環境でコマンドを実行し、コマンドの標準出力でコマン ド置換を置き換えることで、コマンド置換を展開し、置換の最後にある1つ以上の ⟨改行⟩のシーケンスを削除する。 (出力の末尾の前に埋め込まれた⟩は削除されないが、フィールド分割の際に、有効なIFSとquotingの値によっては、⟨space⟩に変換されることがある)。 |
| ing the command substitution with the standard output of the command, removing sequences of one or
| |
| more ⟨newline⟩s at the end of the substitution. (Embedded ⟨newline⟩s before the end of the output are
| |
| not removed; however, during field splitting, they may be translated into ⟨space⟩s, depending on the
| |
| value of IFS and quoting that is in effect.)
| |
|
| |
|
| === Arithmetic Expansion === | | === Arithmetic Expansion === |
| Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its
| | 算術展開は、算術式を評価し、その値を代入するメカニズムを提供する。 算術展開の書式は以下の通りである: |
| value. The format for arithmetic expansion is as follows:
| |
|
| |
|
| $((expression)) | | $((expression)) |
|
| |
|
| The expression is treated as if it were in double-quotes, except that a double-quote inside the ex‐
| | 式は二重引用符で囲まれているかのように扱われるが、式の中の二重引用符は特別に扱われない。 シェルは、パラメータ展開、コマンド置換、引用符除去のために、式のすべてのトークンを展開する。 |
| pression is not treated specially. The shell expands all tokens in the expression for parameter ex‐
| |
| pansion, command substitution, and quote removal.
| |
|
| |
|
| Next, the shell treats this as an arithmetic expression and substitutes the value of the expression.
| | 次に、シェルはこれを算術式として扱い、式の値を代入する。 |
|
| |
|
| === White Space Splitting (Field Splitting) === | | === White Space Splitting (Field Splitting) === |
| After parameter expansion, command substitution, and arithmetic expansion the shell scans the results
| | パラメータ展開、コマンド置換、算術展開の後、シェルはフィールド分割のためにダブルクォートで発生しなかった展開と置換の結果をスキャンし、複数のフィールドが発生することがある。 |
| of expansions and substitutions that did not occur in double-quotes for field splitting and multiple
| |
| fields can result.
| |
|
| |
|
| The shell treats each character of the IFS as a delimiter and uses the delimiters to split the results
| | シェルはIFSの各文字をデリミタとして扱い、デリミタを使ってパラメータ展開やコマンド置換の結果をフィールドに分割する。 |
| of parameter expansion and command substitution into fields.
| |
|
| |
|
| === Pathname Expansion (File Name Generation) === | | === Pathname Expansion (File Name Generation) === |
| Unless the -f flag is set, file name generation is performed after word splitting is complete. Each
| | -fフラグが設定されていない限り、ファイル名の生成は単語の分割が完了した後に行われる。 各単語は,スラッシュで区切られた一連のパターンとみなされる。 展開の処理では,各パターンを指定されたパターンに一致する文字列に置き換えることでファイル名を形成できるすべての既存ファイルの名前に単語を置き換える. これには2つの制約がある。第1に,パターンはスラッシュを含む文字列にはマッチしないこと,第2に,パターンの最初の文字がピリオドでない限り,パターンはピリオドで始まる文字列にマッチしないことである。 次のセクションでは、Pathname Expansionとcaseコマンドの両方に使用されるパターンについて説明する。 |
| word is viewed as a series of patterns, separated by slashes. The process of expansion replaces the
| |
| word with the names of all existing files whose names can be formed by replacing each pattern with a
| |
| string that matches the specified pattern. There are two restrictions on this: first, a pattern can‐
| |
| not match a string containing a slash, and second, a pattern cannot match a string starting with a pe‐
| |
| riod unless the first character of the pattern is a period. The next section describes the patterns
| |
| used for both Pathname Expansion and the case command.
| |
|
| |
|
| === Shell Patterns === | | === Shell Patterns === |
| A pattern consists of normal characters, which match themselves, and meta-characters. The meta-char‐
| | パターンは、それ自体にマッチする通常の文字と、メタ文字で構成される。 メタ文字は、<nowiki>"!"、"*"、"?"、"["</nowiki>である。 これらの文字は,引用符で囲むと特別な意味を失う。 |
| acters are “!”, “*”, “?”, and “[”. These characters lose their special meanings if they are quoted.
| | コマンドや変数の置換が行われ、ドル記号やバッククォートが二重引用符で囲まれていない場合、変数の値やコマンドの出力がこれらの文字をスキャンし、それらはメタ文字に変わる。 |
| When command or variable substitution is performed and the dollar sign or back quotes are not double
| |
| quoted, the value of the variable or the output of the command is scanned for these characters and
| |
| they are turned into meta-characters.
| |
|
| |
|
| An asterisk (“*”) matches any string of characters. A question mark matches any single character. A
| | アスタリスク<nowiki>("*")</nowiki>は、任意の文字列と一致する。 クエスチョンマークは、任意の1文字にマッチする。 左括弧<nowiki>("[")</nowiki>は、文字クラスを導入する。 文字クラスの終わりは<nowiki>("]")</nowiki>で示される。<nowiki>"]"</nowiki>がない場合、<nowiki>"["</nowiki>は文字クラスを導入するのではなく、<nowiki>"["</nowiki>にマッチする。 文字クラスは,角括弧の間の任意の文字にマッチする。 マイナス記号で文字の範囲を指定することもできる。 感嘆符を文字クラスの最初の文字とすることで,文字クラスを補完することができる。 |
| left bracket (“[”) introduces a character class. The end of the character class is indicated by a
| |
| (“]”); if the “]” is missing then the “[” matches a “[” rather than introducing a character class. A
| |
| character class matches any of the characters between the square brackets. A range of characters may
| |
| be specified using a minus sign. The character class may be complemented by making an exclamation
| |
| point the first character of the character class.
| |
|
| |
|
| To include a “]” in a character class, make it the first character listed (after the “!”, if any). To
| | 文字クラスに<nowiki>"]"</nowiki>を含めるには,(もしあれば<nowiki>"!"</nowiki>の後に)最初にリストされる文字にする。 マイナス記号を含めるには、最初か最後の文字にする。 |
| include a minus sign, make it the first or last character listed.
| |
|
| |
|
| === Builtins === | | === Builtins === |
| This section lists the builtin commands which are builtin because they need to perform some operation
| | このセクションでは、別のプロセスでは実行できない何らかの操作を行う必要があるためにビルトインされているビルトインコマンドを列挙する。 これら以外にも、効率化のためにビルトインされるコマンドがいくつかある(例:'''[[/usr/bin/printf|printf]]''', '''[[/usr/bin/echo|echo]]''', '''[[/usr/bin/test|test]]''' など)。 |
| that can't be performed by a separate process. In addition to these, there are several other commands
| |
| that may be builtin for efficiency (e.g. printf(1), echo(1), test(1), etc).
| |
|
| |
|
| :
| | : |
|
| |
|
| true A null command that returns a 0 (true) exit value.
| | ;true |
| | :終了値0(真)を返すヌルコマンドである。 |
|
| |
|
| . file
| | ;file |
| The commands in the specified file are read and executed by the shell.
| | :指定されたファイル内のコマンドをシェルが読み込んで実行する。 |
|
| |
|
| alias [name[=string ...]]
| | ;alias [name[=string ...]] |
| If name=string is specified, the shell defines the alias name with value string. If just name
| | :name=stringが指定された場合、シェルはエイリアス名を値文字列で定義する。 name だけが指定された場合,エイリアス名の値が表示される。 引数を指定しない場合,alias builtinは,定義されたすべてのエイリアスの名前と値を表示する(unaliasを参照)。 |
| is specified, the value of the alias name is printed. With no arguments, the alias builtin
| |
| prints the names and values of all defined aliases (see unalias).
| |
|
| |
|
| bg [job] ...
| | ;bg [job] ... |
| Continue the specified jobs (or the current job if no jobs are given) in the background.
| | :指定されたジョブ(ジョブが指定されていない場合は現在のジョブ)をバックグラウンドで継続する。 |
|
| |
|
| command [-p] [-v] [-V] command [arg ...]
| | ;command [-p] [-v] [-V] command [arg ...] |
| Execute the specified command but ignore shell functions when searching for it. (This is use‐
| | :指定されたコマンドを実行するが、そのコマンドを検索する際にシェル関数を無視する。 (これは、組み込みコマンドと同じ名前のシェル関数がある場合に便利である)。 |
| ful when you have a shell function with the same name as a builtin command.)
| |
|
| |
|
| -p search for command using a PATH that guarantees to find all the standard utilities.
| | ;-p |
| | :PATH を使ってコマンドを検索し、すべての標準ユーティリティを見つけることが保証される。 |
|
| |
|
| -V Do not execute the command but search for the command and print the resolution of the
| | ;-V |
| command search. This is the same as the type builtin.
| | :コマンドを実行せず、コマンドを検索し、コマンド検索の解答を表示する。 これはタイプビルトインと同じである。 |
|
| |
|
| -v Do not execute the command but search for the command and print the absolute pathname of
| | ;-v |
| utilities, the name for builtins or the expansion of aliases.
| | コマンドを実行せず、コマンドを検索し、ユーティリティの絶対パス名、ビルトインの名前,エイリアスの展開名を表示する。 |
|
| |
|
| cd -
| | ;cd - |
|
| |
|
| cd [-LP] [directory]
| | ;cd [-LP] [directory] |
| Switch to the specified directory (default HOME). If an entry for CDPATH appears in the envi‐
| | :指定されたディレクトリに切り替える(デフォルトはHOME)。 cdコマンドの環境にCDPATHの項目があるか,シェル変数CDPATHが設定されていて,ディレクトリ名がスラッシュで始まらない場合,CDPATHに記載されているディレクトリを検索して,指定したディレクトリに移動する。 CDPATHの形式は,PATHの形式と同じである。 引数に単一のダッシュが指定された場合、それはOLDPWDの値に置き換えられる。 cdコマンドは,実際に切り替えたディレクトリの名前が,ユーザが与えた名前と異なる場合,その名前を出力する。 これらは、CDPATH機構が使用されたためか、引数がダッシュ1つであったためか、異なる可能性がある。 Pオプションは、物理的なディレクトリ構造を使用するようにする。つまり、すべてのシンボリックリンクはそれぞれの値に解決される。 Lオプションは、先行する-Pオプションの効果を無効にする。 |
| ronment of the cd command or the shell variable CDPATH is set and the directory name does not
| |
| begin with a slash, then the directories listed in CDPATH will be searched for the specified
| |
| directory. The format of CDPATH is the same as that of PATH. If a single dash is specified as
| |
| the argument, it will be replaced by the value of OLDPWD. The cd command will print out the
| |
| name of the directory that it actually switched to if this is different from the name that the
| |
| user gave. These may be different either because the CDPATH mechanism was used or because the
| |
| argument is a single dash. The -P option causes the physical directory structure to be used,
| |
| that is, all symbolic links are resolved to their respective values. The -L option turns off
| |
| the effect of any preceding -P options.
| |
|
| |
|
| echo [-n] args...
| | ;echo [-n] args... |
| Print the arguments on the standard output, separated by spaces. Unless the -n option is
| | :引数をスペースで区切って標準出力に出力する。 nオプションがない限り、引数の後に改行が出力される。 |
| present, a newline is output following the arguments.
| |
|
| |
|
| If any of the following sequences of characters is encountered during output, the sequence is
| | :出力中に以下の文字列のいずれかに遭遇した場合、その文字列は出力されない。 出力中に以下の文字列に遭遇した場合、その文字列は出力されず、代わりに指定された動作が実行される: |
| not output. Instead, the specified action is performed:
| |
|
| |
|
| \b A backspace character is output.
| | ::\b バックスペース文字が出力される。 |
|
| |
|
| \c Subsequent output is suppressed. This is normally used at the end of the last argument
| | ::\c その後の出力を抑制する。 通常、最後の引数の末尾で使用し、echo が出力するはずの末尾の改行を抑止する。 |
| to suppress the trailing newline that echo would otherwise output.
| |
|
| |
|
| \e Outputs an escape character (ESC).
| | ::\e エスケープ文字(ESC)を出力する。 |
|
| |
|
| \f Output a form feed.
| | ::\f フォームフィードを出力する。 |
|
| |
|
| \n Output a newline character.
| | ::\n 改行文字を出力する。 |
|
| |
|
| \r Output a carriage return.
| | ::\r キャリッジリターンを出力する。 |
|
| |
|
| \t Output a (horizontal) tab character.
| | ::\t (横)タブ文字を出力する。 |
|
| |
|
| \v Output a vertical tab.
| | ::\v (縦)タブを出力する。 |
|
| |
|
| \0digits
| | ::\0digits |
| Output the character whose value is given by zero to three octal digits. If there are
| | :::8進数0~3桁で与えられる値を持つ文字を出力する。 0桁の場合はnul文字が出力される。 |
| zero digits, a nul character is output.
| |
|
| |
|
| \\ Output a backslash.
| | ::\\ バックスラッシュを出力する。 |
|
| |
|
| All other backslash sequences elicit undefined behaviour.
| | :それ以外のバックスラッシュの配列は、未定義の動作を引き起こす。 |
|
| |
|
| eval string ...
| | ;eval string ... |
| Concatenate all the arguments with spaces. Then re-parse and execute the command.
| | :すべての引数をスペースで連結する。 その後、コマンドを再パースして実行する。 |
|
| |
|
| exec [command arg ...]
| | ;exec [command arg ...] |
| Unless command is omitted, the shell process is replaced with the specified program (which must
| | :commandが省略されない限り、シェルプロセスは指定されたプログラム(これはシェルの組み込みや関数ではなく、実際のプログラムでなければならない)に置き換えられる。 execコマンドのリダイレクションは、execコマンドの終了時に元に戻らないように、永久的なものとしてマークされる。 |
| be a real program, not a shell builtin or function). Any redirections on the exec command are
| |
| marked as permanent, so that they are not undone when the exec command finishes.
| |
|
| |
|
| exit [exitstatus]
| | ;exit [exitstatus] |
| Terminate the shell process. If exitstatus is given it is used as the exit status of the
| | :シェルプロセスを終了させる。 exitstatusが与えられた場合は、シェルの終了ステータスとして使用され、それ以外の場合は、直前のコマンドの終了ステータスが使用される。 |
| shell; otherwise the exit status of the preceding command is used.
| |
|
| |
|
| export name ...
| | ;export name ... |
|
| |
|
| export -p
| | ;export -p |
| The specified names are exported so that they will appear in the environment of subsequent com‐
| | :指定された名前は、後続のコマンドの環境に表示されるようにエクスポートされる。 変数のエクスポートを解除する唯一の方法は、変数の設定を解除することである。 シェルでは,次のように書くことで,変数のエクスポートと同時に変数の値を設定することができる。 |
| mands. The only way to un-export a variable is to unset it. The shell allows the value of a
| |
| variable to be set at the same time it is exported by writing
| |
|
| |
|
| export name=value
| | ::export name=value |
|
| |
|
| With no arguments the export command lists the names of all exported variables. With the -p
| | :引数を指定しない場合、exportコマンドはエクスポートされたすべての変数名を一覧表示する。 pオプションを指定すると、出力は非対話的な使用のために適切にフォーマットされる。 |
| option specified the output will be formatted suitably for non-interactive use.
| |
|
| |
|
| fc [-e editor] [first [last]]
| | ;fc [-e editor] [first [last]] |
|
| |
|
| fc -l [-nr] [first [last]]
| | ;fc -l [-nr] [first [last]] |
|
| |
|
| fc -s [old=new] [first]
| | ;fc -s [old=new] [first] |
| The fc builtin lists, or edits and re-executes, commands previously entered to an interactive
| | :fcビルトインは、対話型シェルに過去に入力したコマンドを一覧表示したり、編集して再実行する。 |
| shell.
| |
|
| |
|
| -e editor
| | :-e editor |
| Use the editor named by editor to edit the commands. The editor string is a command
| | ::コマンドの編集には、editorで指定されたエディタを使用する。 エディタ文字列はコマンド名であり、PATH変数による検索の対象となる。 eが指定されない場合、FCEDIT変数の値がデフォルトとして使用される。 FCEDITがNULLまたは未設定の場合は、EDITOR変数の値が使用される。 EDITORがNULLまたは未設定の場合、エディタとして'''[[/usr/bin/ed|ed]]'''が使用される。 |
| name, subject to search via the PATH variable. The value in the FCEDIT variable is used
| |
| as a default when -e is not specified. If FCEDIT is null or unset, the value of the
| |
| EDITOR variable is used. If EDITOR is null or unset, ed(1) is used as the editor.
| |
|
| |
|
| -l (ell)
| | :-l (ell) |
| List the commands rather than invoking an editor on them. The commands are written in
| | ::コマンドに対してエディタを起動するのではなく、コマンドをリストアップする。 コマンドは,-rの影響を受けて,最初と最後のオペランドで示される順序で書かれ,各コマンドの前にはコマンド番号が付けられる. |
| the sequence indicated by the first and last operands, as affected by -r, with each com‐
| |
| mand preceded by the command number.
| |
|
| |
|
| -n Suppress command numbers when listing with -l.
| | :-n -lでリストアップする際に、コマンド番号を表示しないようにする。 |
|
| |
|
| -r Reverse the order of the commands listed (with -l) or edited (with neither -l nor -s).
| | :-r リストアップされたコマンド(-l付き)または編集されたコマンド(-lも-sもなし)の順序を逆にする。 |
|
| |
|
| -s Re-execute the command without invoking an editor.
| | :-s エディタを起動せずにコマンドを再実行する。 |
|
| |
|
| first
| | :first |
|
| |
|
| last Select the commands to list or edit. The number of previous commands that can be ac‐
| | :last リストアップまたは編集するコマンドを選択する。 アクセスできる前のコマンドの数は、変数HISTSIZEの値によって決定される。 firstまたはlast、あるいはその両方の値は、次のいずれかである: |
| cessed are determined by the value of the HISTSIZE variable. The value of first or last
| |
| or both are one of the following:
| |
|
| |
|
| [+]number
| | ::[+]number |
| A positive number representing a command number; command numbers can be displayed
| | :::コマンド番号を表す正の数。コマンド番号は-lオプションで表示することができる。 |
| with the -l option.
| |
|
| |
|
| -number
| | ::-number |
| A negative decimal number representing the command that was executed number of
| | :::何個か前に実行されたコマンドを表す負の10進数である。 例えば、-1 は直前のコマンドである。 |
| commands previously. For example, -1 is the immediately previous command.
| |
|
| |
|
| string
| | :string |
| A string indicating the most recently entered command that begins with that string. If
| | ::その文字列で始まる、最も最近入力されたコマンドを示す文字列である。 old=newオペランドが-sでも指定されない場合、最初のオペランドの文字列形式は、埋め込まれた等号を含むことはできない。 |
| the old=new operand is not also specified with -s, the string form of the first operand
| |
| cannot contain an embedded equal sign.
| |
|
| |
|
| The following environment variables affect the execution of fc:
| | :以下の環境変数がfcの実行に影響を与える: |
|
| |
|
| FCEDIT Name of the editor to use.
| | :FCEDIT 使用するエディターの名前。 |
|
| |
|
| HISTSIZE The number of previous commands that are accessible.
| | :HISTSIZE アクセス可能な過去のコマンドの数。 |
|
| |
|
| fg [job]
| | ;fg [job] |
| Move the specified job or the current job to the foreground.
| | :指定されたジョブまたは現在のジョブをフォアグラウンドに移動させる。 |
|
| |
|
| getopts optstring var
| | ;gtopts optstring var |
| The POSIX getopts command, not to be confused with the Bell Labs -derived getopt(1).
| | :POSIXのgetoptsコマンドで、ベル研由来の'''[[/usr/bin/getopt|getopt]]'''と混同しないように。 |
|
| |
|
| The first argument should be a series of letters, each of which may be optionally followed by a
| | :最初の引数は、一連の文字でなければならず、それぞれの文字には、オプションが引数を必要とすることを示すコロンがオプションとして続くことができる。 指定された変数は,解析されたオプションに設定される。 |
| colon to indicate that the option requires an argument. The variable specified is set to the
| |
| parsed option.
| |
|
| |
|
| The getopts command deprecates the older getopt(1) utility due to its handling of arguments
| | :getoptsコマンドは、空白を含む引数の扱いのため、古い'''[[/usr/bin/getopt|getopt]]'''ユーティリティを非推奨とする。 |
| containing whitespace.
| |
|
| |
|
| The getopts builtin may be used to obtain options and their arguments from a list of parame‐
| | :getopts 組み込み関数を使って、パラメータのリストからオプションとその引数を取得することができる。 getoptsは,起動されると,リスト中のオプション文字列から次のオプションの値をvarで指定されるシェル変数に,そのインデックスをシェル変数OPTINDに置く。 シェルが起動されると、OPTINDは1に初期化される。 引数を必要とする各オプションについて、getopts 組み込み関数がシェル変数 OPTARG に配置する。 オプションがoptstringで許可されていない場合、OPTARGはアンセットされる。 |
| ters. When invoked, getopts places the value of the next option from the option string in the
| |
| list in the shell variable specified by var and its index in the shell variable OPTIND. When
| |
| the shell is invoked, OPTIND is initialized to 1. For each option that requires an argument,
| |
| the getopts builtin will place it in the shell variable OPTARG. If an option is not allowed
| |
| for in the optstring, then OPTARG will be unset.
| |
|
| |
|
| optstring is a string of recognized option letters (see getopt(3)). If a letter is followed by
| | :optstring は、認識されたオプション文字列である ('''[https://manpages.debian.org/bullseye/manpages-dev/getopt.3.en.html getopt]]'''(3) を参照)。 文字にコロンが続く場合、そのオプションは空白で区切られていてもいなくてもよい引数を持つことが期待される。 オプション文字が期待通りに見つからなかった場合、getopts は変数 var を "?" に設定する; 次に getopts は OPTARG をアンセットして標準エラーに出力を書き出す。 optstringの最初の文字にコロンを指定することで、すべてのエラーを無視することができる。 |
| a colon, the option is expected to have an argument which may or may not be separated from it
| |
| by white space. If an option character is not found where expected, getopts will set the vari‐
| |
| able var to a “?”; getopts will then unset OPTARG and write output to standard error. By spec‐
| |
| ifying a colon as the first character of optstring all errors will be ignored.
| |
|
| |
|
| After the last option getopts will return a non-zero value and set var to “?”.
| | :最後のオプションの後、getoptsは0以外の値を返し、varに"?"をセットする。 |
|
| |
|
| The following code fragment shows how one might process the arguments for a command that can
| | :次のコードは、オプション<nowiki>[a]</nowiki>と<nowiki>[b]</nowiki>、および引数を必要とするオプション<nowiki>[c]</nowiki>を取ることができるコマンドの引数をどのように処理するかを示している。 |
| take the options [a] and [b], and the option [c], which requires an argument.
| |
|
| |
|
| | <syntaxhighlight lang="bash"> |
| while getopts abc: f | | while getopts abc: f |
| do | | do |
Line 807: |
Line 619: |
| done | | done |
| shift `expr $OPTIND - 1` | | shift `expr $OPTIND - 1` |
| | </syntaxhighlight> |
|
| |
|
| This code will accept any of the following as equivalent:
| | :本コードは、以下のいずれかを等価として受け付ける: |
|
| |
|
| | <syntaxhighlight lang="bash"> |
| cmd -acarg file file | | cmd -acarg file file |
| cmd -a -c arg file file | | cmd -a -c arg file file |
| cmd -carg -a file file | | cmd -carg -a file file |
| cmd -a -carg -- file file | | cmd -a -carg -- file file |
| | </syntaxhighlight> |
| | |
| | ;hash -rv command ... |
| | :シェルは、コマンドの位置を記憶するハッシュテーブルを保持している。 引数なしで、hashコマンドはこのテーブルの内容をプリントアウトする。 最後にcdコマンドを実行してから一度も見ていない項目には、アスタリスクが付けられている。これらの項目が無効である可能性もある。 |
|
| |
|
| hash -rv command ...
| | :引数を指定すると、hashコマンドは指定されたコマンドをハッシュテーブルから削除し(それが関数でない限り)、次にそれらの位置を特定する。 -vオプションをつけると、ハッシュは見つけたコマンドの位置を表示する。 -rオプションをつけると、hashコマンドはハッシュテーブルの関数を除くすべてのエントリーを削除する。 |
| The shell maintains a hash table which remembers the locations of commands. With no arguments
| |
| whatsoever, the hash command prints out the contents of this table. Entries which have not
| |
| been looked at since the last cd command are marked with an asterisk; it is possible for these
| |
| entries to be invalid.
| |
|
| |
|
| With arguments, the hash command removes the specified commands from the hash table (unless
| | ;pwd [-LP] |
| they are functions) and then locates them. With the -v option, hash prints the locations of
| | :内蔵コマンドは、毎回再計算するのではなく、カレントディレクトリが何であるかを記憶している。そのため、より高速に動作する。 しかし,カレントディレクトリの名前が変更された場合,pwdのビルトイン版はディレクトリの古い名前を表示しつづける. -Pオプションは、現在の作業ディレクトリの物理的な値を表示する、つまり、すべてのシンボリックリンクがそれぞれの値に解決されるようにする。 -Lオプションは,先行する-Pオプションの効果を無効にする. |
| the commands as it finds them. The -r option causes the hash command to delete all the entries
| |
| in the hash table except for functions.
| |
|
| |
|
| pwd [-LP]
| | ;read [-p prompt] [-r] variable [...] |
| builtin command remembers what the current directory is rather than recomputing it each time.
| | :-pオプションが指定され,標準入力が端末である場合は,プロンプトが表示される。 次に,標準入力から1行が読み込まれる。 行末の改行が削除され,上記の単語分割の項で説明したように行が分割され,その断片が順番に変数に代入される。 少なくとも1つの変数が指定されなければならない。 駒が変数より多い場合は、残りの駒(駒を区切ったIFSの文字とともに)が最後の変数に代入される。 ピースより変数の方が多い場合は、残りの変数にヌル文字列が代入される。 入力で EOF に遭遇しない限り、read 組み込みは成功を示し、その場合は失敗が返される。 |
| This makes it faster. However, if the current directory is renamed, the builtin version of pwd
| |
| will continue to print the old name for the directory. The -P option causes the physical value
| |
| of the current working directory to be shown, that is, all symbolic links are resolved to their
| |
| respective values. The -L option turns off the effect of any preceding -P options.
| |
|
| |
|
| read [-p prompt] [-r] variable [...]
| | :デフォルトでは、-rオプションが指定されない限り、バックスラッシュ"˶"はエスケープ文字として機能し、次の文字を文字通りに処理する。 バックスラッシュの後に改行がある場合、バックスラッシュと改行は削除される。 |
| The prompt is printed if the -p option is specified and the standard input is a terminal. Then
| |
| a line is read from the standard input. The trailing newline is deleted from the line and the
| |
| line is split as described in the section on word splitting above, and the pieces are assigned
| |
| to the variables in order. At least one variable must be specified. If there are more pieces
| |
| than variables, the remaining pieces (along with the characters in IFS that separated them) are
| |
| assigned to the last variable. If there are more variables than pieces, the remaining vari‐
| |
| ables are assigned the null string. The read builtin will indicate success unless EOF is en‐
| |
| countered on input, in which case failure is returned.
| |
|
| |
|
| By default, unless the -r option is specified, the backslash “\” acts as an escape character,
| | ;readonly name ... |
| causing the following character to be treated literally. If a backslash is followed by a new‐
| |
| line, the backslash and the newline will be deleted.
| |
|
| |
|
| readonly name ...
| | ;readonly -p |
| | :指定された名前は読み取り専用としてマークされ、その後に変更したり設定を解除したりすることはできない。 シェルは,変数の値を,それが読み取り専用にマークされると同時に設定することを,次のように書くことで可能にする。 |
|
| |
|
| readonly -p
| | ;readonly name=value |
| The specified names are marked as read only, so that they cannot be subsequently modified or
| |
| unset. The shell allows the value of a variable to be set at the same time it is marked read
| |
| only by writing
| |
|
| |
|
| readonly name=value
| | :引数を指定しない場合、readonlyコマンドはすべての読み取り専用変数の名前を一覧表示する。 -pオプションを指定すると、出力は非対話的な使用に適した形式になる。 |
|
| |
|
| With no arguments the readonly command lists the names of all read only variables. With the -p
| | ;printf format [arguments ...] |
| option specified the output will be formatted suitably for non-interactive use.
| | :printfは、フォーマットの制御の下、引数をフォーマットし、最初の引数の後に印刷する。 フォーマットは,3種類のオブジェクトを含む文字列である。すなわち,単に標準出力にコピーされるプレーン文字,変換されて標準出力にコピーされる文字エスケープシーケンス,およびフォーマット指定であり,その各々が次の連続する引数の印刷を引き起こす。 |
|
| |
|
| printf format [arguments ...]
| | :第1引数以降の引数は,対応する形式がb,c,sのいずれかであれば文字列として扱われ,そうでなければC定数として評価され,次のように拡張される: |
| printf formats and prints its arguments, after the first, under control of the format. The
| |
| format is a character string which contains three types of objects: plain characters, which are
| |
| simply copied to standard output, character escape sequences which are converted and copied to
| |
| the standard output, and format specifications, each of which causes printing of the next suc‐
| |
| cessive argument.
| |
|
| |
|
| The arguments after the first are treated as strings if the corresponding format is either b, c
| | ::• 先頭のプラスまたはマイナス記号は許容される。 |
| or s; otherwise it is evaluated as a C constant, with the following extensions:
| | ::• 先頭の文字がシングルクォートまたはダブルクォートの場合、値は次の文字のASCIIコードとなる。 |
|
| |
|
| • A leading plus or minus sign is allowed.
| | :書式文字列は,引数を満たすのに必要な回数だけ再利用される。 余分な書式指定は,0またはNULL文字列で評価される。 |
| • If the leading character is a single or double quote, the value is the ASCII code of
| |
| the next character.
| |
|
| |
|
| The format string is reused as often as necessary to satisfy the arguments. Any extra format
| | :文字エスケープシーケンスは、ANSI X3.159-1989("ANSI C89")で定義されているバックスラッシュ表記である。 文字とその意味は次の通りである: |
| specifications are evaluated with zero or the null string.
| |
|
| |
|
| Character escape sequences are in backslash notation as defined in ANSI X3.159-1989
| | ::\a <bell>のキャラクターを書く。 |
| (“ANSI C89”). The characters and their meanings are as follows:
| |
|
| |
|
| \a Write a <bell> character.
| | ::\b <backspace>文字を書く。 |
|
| |
|
| \b Write a <backspace> character.
| | ::\e <escape>(ESC)文字を書く。 |
|
| |
|
| \e Write an <escape> (ESC) character.
| | ::\f <form-feed>文字を書く。 |
|
| |
|
| \f Write a <form-feed> character.
| | ::\n <改行>文字を書く。 |
|
| |
|
| \n Write a <new-line> character.
| | ::\r <carriage return>文字を書く。 |
|
| |
|
| \r Write a <carriage return> character.
| | ::\t <tab>文字を書く。 |
|
| |
|
| \t Write a <tab> character.
| | ::\v <垂直タブ>文字を書く。 |
|
| |
|
| \v Write a <vertical tab> character.
| | ::\\ バックスラッシュ文字を書き込む。 |
|
| |
|
| \\ Write a backslash character.
| | ::\num ASCII値が1桁、2桁、3桁の8進数numである8ビット文字を書く。 |
|
| |
|
| \num Write an 8-bit character whose ASCII value is the 1-, 2-, or 3-digit octal number
| | :各フォーマット指定は,パーセント文字(``%'')によって導入される。 フォーマット指定の残りは,次の順序で,以下を含む: |
| num.
| |
|
| |
|
| Each format specification is introduced by the percent character (``%''). The remainder of the
| | :以下のフラグのうち、0個以上を指定する: |
| format specification includes, in the following order:
| |
|
| |
|
| Zero or more of the following flags:
| | ::# 代替形式で表示されることを指定する `#' 文字を指定する。 b,c,d,sフォーマットでは,このオプションは何の効果もない。 oフォーマットでは,数値の精度を上げて,出力文字列の最初の文字をゼロにする。 x(エックス)フォーマットでは,0以外の結果には,文字列0x(0X)が先頭に付く。 e、E、f、g、G形式では、小数点以下の桁がない場合でも、結果には常に小数点が含まれる(通常、これらの形式の結果には、小数点以下の桁がある場合にのみ小数点が表示される)。 gおよびGフォーマットでは、末尾のゼロは、他の場合と同様に結果から取り除かれない。 |
|
| |
|
| # A `#' character specifying that the value should be printed in an ``alternative
| | ::- マイナス記号 `-' は、指定されたフィールドの出力を左に調整することを指定する; |
| form''. For b, c, d, and s formats, this option has no effect. For the o for‐
| |
| mat the precision of the number is increased to force the first character of
| |
| the output string to a zero. For the x (X) format, a non-zero result has the
| |
| string 0x (0X) prepended to it. For e, E, f, g, and G formats, the result will
| |
| always contain a decimal point, even if no digits follow the point (normally, a
| |
| decimal point only appears in the results of those formats if a digit follows
| |
| the decimal point). For g and G formats, trailing zeros are not removed from
| |
| the result as they would otherwise be.
| |
|
| |
|
| - A minus sign `-' which specifies left adjustment of the output in the indicated
| | ::+ 符号付き書式を使用する場合、数値の前に常に符号を置くことを指定する `+' 文字。 |
| field;
| |
|
| |
|
| + A `+' character specifying that there should always be a sign placed before the
| | ::' ’ 符号付きフォーマットの場合、正の数の前に空白を残すことを指定する。 両方が使われている場合、`+'はスペースより優先される; |
| number when using signed formats.
| |
|
| |
|
| ‘ ’ A space specifying that a blank should be left before a positive number for a
| | ::0 '0'文字は、空白パディングではなく、ゼロパディングを使用することを示す。 両方が使用される場合、`-' は `0' に優先する; |
| signed format. A `+' overrides a space if both are used;
| |
|
| |
|
| 0 A zero `0' character indicating that zero-padding should be used rather than
| | :Field Width: |
| blank-padding. A `-' overrides a `0' if both are used;
| | ::出力文字列の文字数がフィールド幅より少ない場合,フィールド幅を補うために左側(左調整インジケータが与えられている場合は右側)に空白パディングされる(先行ゼロはフラグであるが,埋め込まれたゼロはフィールド幅の一部であることに注意すること); |
|
| |
|
| Field Width:
| | :Precision: |
| An optional digit string specifying a field width; if the output string has fewer char‐
| | ::オプションのピリオド,'.'の後に,eおよびf形式の場合は小数点以下の桁数,bおよびs形式の場合は文字列から出力される最大バイト数を指定する精度を与えるオプションの数字文字列が続く; |
| acters than the field width it will be blank-padded on the left (or right, if the left-
| |
| adjustment indicator has been given) to make up the field width (note that a leading
| |
| zero is a flag, but an embedded zero is part of a field width);
| |
|
| |
|
| Precision:
| | :Format: |
| An optional period, ‘.’, followed by an optional digit string giving a precision which
| | ::使用するフォーマットの種類を示す文字(diouxXfwEgGbcs のいずれか)である。 |
| specifies the number of digits to appear after the decimal point, for e and f formats,
| |
| or the maximum number of bytes to be printed from a string (b and s formats); if the
| |
| digit string is missing, the precision is treated as zero;
| |
|
| |
|
| Format:
| | :フィールドの幅や精度は,数字文字列の代わりに'*'とすることもできる。 この場合,引数でフィールドの幅や精度を指定する。 |
| A character which indicates the type of format to use (one of diouxXfwEgGbcs).
| |
|
| |
|
| A field width or precision may be ‘*’ instead of a digit string. In this case an argument sup‐
| | :フォーマット文字とその意味は次の通りである: |
| plies the field width or precision.
| |
|
| |
|
| The format characters and their meanings are:
| | ::diouXx 引数は,それぞれ符号付き10進数(dまたはi),符号なし8進数,符号なし10進数,符号なし16進数(Xまたはx)として出力される。 |
|
| |
|
| diouXx The argument is printed as a signed decimal (d or i), unsigned octal, unsigned dec‐
| | ::f 引数は,[-]ddd.dddのスタイルで表示され,小数点以下のdの数が引数の精度指定と等しくなる。 精度がない場合は6桁が与えられ,精度が明示的に0である場合は,桁と小数点は表示されない。 |
| imal, or unsigned hexadecimal (X or x), respectively.
| |
|
| |
|
| f The argument is printed in the style [-]ddd.ddd where the number of d's after the
| | ::eE 引数は,[-]d.ddde±ddのスタイルで印刷される。ここで,小数点以下の桁数は引数の精度指定に等しく,精度が不足する場合は6桁が生成される。 E'形式には,大文字のEが使われる。 |
| decimal point is equal to the precision specification for the argument. If the
| |
| precision is missing, 6 digits are given; if the precision is explicitly 0, no dig‐
| |
| its and no decimal point are printed.
| |
|
| |
|
| eE The argument is printed in the style [-]d.ddde±dd where there is one digit before
| | ::gG 引数は,スタイルfまたはスタイルe(E)のどちらか,最小限のスペースで完全な精度を与えるほうで印刷される。 |
| the decimal point and the number after is equal to the precision specification for
| |
| the argument; when the precision is missing, 6 digits are produced. An upper-case
| |
| E is used for an `E' format.
| |
|
| |
|
| gG The argument is printed in style f or in style e (E) whichever gives full precision
| | ::b 文字列引数の文字は、バックスラッシュ・エスケープ・シーケンスを展開した状態で印刷される。以下の追加バックスラッシュ・エスケープ・シーケンスがサポートされている: |
| in minimum space.
| |
|
| |
|
| b Characters from the string argument are printed with backslash-escape sequences ex‐
| | ::\c dashを含む文字列オペランドの残りの文字、残りの文字列オペランド、およびformatオペランドの追加文字を無視するようにする。 |
| panded.
| |
| The following additional backslash-escape sequences are supported:
| |
|
| |
|
| \c Causes dash to ignore any remaining characters in the string operand con‐
| | ::\0num ASCII値が1桁、2桁、3桁の8進数numである8ビット文字を書く。 |
| taining it, any remaining string operands, and any additional characters in
| |
| the format operand.
| |
|
| |
|
| \0num Write an 8-bit character whose ASCII value is the 1-, 2-, or 3-digit octal
| | ::c 引数の1文字目を印字する。 |
| number num.
| |
|
| |
|
| c The first character of argument is printed.
| | ::s 文字列引数の文字は,末尾に達するか,精度指定で示されるバイト数に達するまで印刷される。精度が省略された場合,文字列のすべての文字が印刷される。 |
|
| |
|
| s Characters from the string argument are printed until the end is reached or until
| | ::% 引数なしで `%' を表示する。 |
| the number of bytes indicated by the precision specification is reached; if the
| |
| precision is omitted, all characters in the string are printed.
| |
|
| |
|
| % Print a `%'; no argument is used.
| | :パディングは、指定されたフィールド幅が実際の幅を超える場合にのみ行われる。 |
|
| |
|
| In no case does a non-existent or small field width cause truncation of a field; padding takes
| | ;set [{ -options | +options | -- }] arg ... |
| place only if the specified field width exceeds the actual width.
| | :setコマンドは、3つの異なる機能を実行する。 |
|
| |
|
| set [{ -options | +options | -- }] arg ...
| | :引数なしで、すべてのシェル変数の値をリストアップする。 |
| The set command performs three different functions.
| |
|
| |
|
| With no arguments, it lists the values of all shell variables.
| | :オプションが与えられた場合、引数リスト処理というセクションで説明されているように、指定されたオプションフラグを設定し、またはそれらをクリアする。 特殊なケースとして、オプションが-oまたは+oで引数が与えられない場合、シェルはそのすべてのオプションの設定を印刷する。 オプションが-oの場合,設定は人間が読める形式で印刷され,オプションが+oの場合,設定は,同じオプション設定に影響を与えるためにシェルに再入力するのに適した形式で印刷される。 |
|
| |
|
| If options are given, it sets the specified option flags, or clears them as described in the
| | :setコマンドの3つ目の使い方は、シェルの位置パラメーターの値を指定されたargsに設定することである。 オプションを変更せずに位置パラメータを変更するには、setの第1引数として「--」を使用する。 引数がない場合、setコマンドはすべての位置パラメータをクリアする(「shift $#」を実行するのと同じことである)。 |
| section called Argument List Processing. As a special case, if the option is -o or +o and no
| |
| argument is supplied, the shell prints the settings of all its options. If the option is -o,
| |
| the settings are printed in a human-readable format; if the option is +o, the settings are
| |
| printed in a format suitable for reinput to the shell to affect the same option settings.
| |
|
| |
|
| The third use of the set command is to set the values of the shell's positional parameters to
| | ;shift [n] |
| the specified args. To change the positional parameters without changing any options, use “--”
| | :位置パラメータをn回シフトさせる。 シフトは、$1の値を$2の値に、$2の値を$3の値に...と、$#の値を1つずつ減らしていくように設定する。 nが位置パラメータの数より大きい場合、shiftはエラーメッセージを発行し、リターンステータス2で終了する。 |
| as the first argument to set. If no args are present, the set command will clear all the posi‐
| |
| tional parameters (equivalent to executing “shift $#”.)
| |
|
| |
|
| shift [n]
| | ;test expression |
| Shift the positional parameters n times. A shift sets the value of $1 to the value of $2, the
| |
| value of $2 to the value of $3, and so on, decreasing the value of $# by one. If n is greater
| |
| than the number of positional parameters, shift will issue an error message, and exit with re‐
| |
| turn status 2.
| |
|
| |
|
| test expression
| | ;[ expression ] |
| | :testユーティリティは、式を評価し、それが真と評価された場合、0(真)の終了ステータスを返し、そうでない場合、1(偽)を返す。 式がない場合、testは1(false)を返す。 |
|
| |
|
| [ expression ]
| | :すべての演算子やフラグは、テストユーティリティの個別の引数である。 |
| The test utility evaluates the expression and, if it evaluates to true, returns a zero (true)
| |
| exit status; otherwise it returns 1 (false). If there is no expression, test also returns 1
| |
| (false).
| |
|
| |
|
| All operators and flags are separate arguments to the test utility.
| | :表現を構築するために、以下のプライマリーを使用する: |
|
| |
|
| The following primaries are used to construct expression:
| | ::-b file fileが存在し、ブロック特殊ファイルである場合はtrueとなる。 |
|
| |
|
| -b file True if file exists and is a block special file.
| | ::-c file fileが存在し、かつ文字特殊ファイルである場合にtrueとなる。 |
|
| |
|
| -c file True if file exists and is a character special file.
| | ::-d file ファイルが存在し、ディレクトリであればtrueとなる。 |
|
| |
|
| -d file True if file exists and is a directory.
| | ::-e file ファイルが存在する場合、(タイプに関係なく)trueとなる。 |
|
| |
|
| -e file True if file exists (regardless of type).
| | ::-f file ファイルが存在し、通常のファイルであればtrueとなる。 |
|
| |
|
| -f file True if file exists and is a regular file.
| | ::-g file ファイルが存在し、そのグループIDフラグが設定されている場合はtrueとなる。 |
|
| |
|
| -g file True if file exists and its set group ID flag is set.
| | ::-h file ファイルが存在し、シンボリックリンクである場合はtrueとなる。 |
|
| |
|
| -h file True if file exists and is a symbolic link.
| | ::-k file ファイルが存在し、そのスティッキービットが設定されている場合はtrueとなる。 |
|
| |
|
| -k file True if file exists and its sticky bit is set.
| | ::-n string 文字列の長さが0でない場合、trueとなる。 |
|
| |
|
| -n string True if the length of string is nonzero.
| | ::-p file fileが名前付きパイプ(FIFO)であればtrueとなる。 |
|
| |
|
| -p file True if file is a named pipe (FIFO).
| | ::-r file ファイルが存在し、読み取り可能であればtrueとなる。 |
|
| |
|
| -r file True if file exists and is readable.
| | ::-s file ファイルが存在し、かつサイズが0より大きい場合、trueとなる。 |
|
| |
|
| -s file True if file exists and has a size greater than zero.
| | ::-t file_descriptor |
| | :::ファイルディスクリプタ番号がfile_descriptorであるファイルが開いており、かつ端末と関連付けられている場合にtrueとなる。 |
|
| |
|
| -t file_descriptor
| | ::-u file ファイルが存在し、そのユーザIDフラグが設定されている場合はtrueとなる。 |
| True if the file whose file descriptor number is file_descriptor is open and is
| |
| associated with a terminal.
| |
|
| |
|
| -u file True if file exists and its set user ID flag is set.
| | ::-w file ファイルが存在し、書き込み可能であればtrueとなる。 Trueは、書き込みフラグがオンであることだけを示す。 このテストが真であっても、読み取り専用ファイルシステム上では、ファイルは書き込み可能ではない。 |
|
| |
|
| -w file True if file exists and is writable. True indicates only that the write flag is
| | ::-x file ファイルが存在し、実行可能であればtrueとなる。 trueは、実行フラグがオンであることのみを示す。 fileがディレクトリの場合、trueはファイルが検索可能であることを示す。 |
| on. The file is not writable on a read-only file system even if this test indi‐
| |
| cates true.
| |
|
| |
|
| -x file True if file exists and is executable. True indicates only that the execute flag
| | ::-z string 文字列の長さがゼロの場合、trueとなる。 |
| is on. If file is a directory, true indicates that file can be searched.
| |
|
| |
|
| -z string True if the length of string is zero.
| | ::-L file ファイルが存在し、シンボリックリンクである場合はtrueとなる。 この演算子は、このプログラムの以前のバージョンとの互換性のために残されている。 この演算子の存在に依存せず、代わりに-hを使用する。 |
|
| |
|
| -L file True if file exists and is a symbolic link. This operator is retained for com‐
| | ::-O file ファイルが存在し、その所有者がこのプロセスの有効なユーザIDと一致する場合、trueとなる。 |
| patibility with previous versions of this program. Do not rely on its existence;
| |
| use -h instead.
| |
|
| |
|
| -O file True if file exists and its owner matches the effective user id of this process.
| | ::-G file ファイルが存在し、そのグループがこのプロセスの有効なグループIDに一致する場合、trueとなる。 |
|
| |
|
| -G file True if file exists and its group matches the effective group id of this process.
| | ::-S file ファイルが存在し、かつソケットであればtrueとなる。 |
|
| |
|
| -S file True if file exists and is a socket.
| | ::file1 -nt file2 |
| | :::file1とfile2が存在し、file1がfile2より新しい場合にtrueとなる。 |
|
| |
|
| file1 -nt file2
| | ::file1 -ot file2 |
| True if file1 and file2 exist and file1 is newer than file2.
| | :::file1とfile2が存在し、file1がfile2より古い場合にtrueとなる。 |
|
| |
|
| file1 -ot file2
| | ::file1 -ef file2 |
| True if file1 and file2 exist and file1 is older than file2.
| | :::file1とfile2が存在し、同じファイルを参照している場合はtrueとなる。 |
|
| |
|
| file1 -ef file2
| | ::string stringがNULL文字列でない場合はtrueとなる。 |
| True if file1 and file2 exist and refer to the same file.
| |
|
| |
|
| string True if string is not the null string.
| | ::s1 = s2 文字列s1、s2が同一であればtrueとなる。 |
|
| |
|
| s1 = s2 True if the strings s1 and s2 are identical.
| | ::s1 != s2 文字列s1、s2が同一でない場合にtrueとなる。 |
|
| |
|
| s1 != s2 True if the strings s1 and s2 are not identical.
| | ::s1 < s2 文字列s1がs2より先に来た場合、それらの文字のASCII値に基づいてtrueとなる。 |
|
| |
|
| s1 < s2 True if string s1 comes before s2 based on the ASCII value of their characters.
| | ::s1 > s2 文字列s1がs2の後に来る場合、それらの文字のASCII値に基づいてtrueとなる。 |
|
| |
|
| s1 > s2 True if string s1 comes after s2 based on the ASCII value of their characters.
| | ::n1 -eq n2 整数n1、n2が代数的に等しければtrueなる。 |
|
| |
|
| n1 -eq n2 True if the integers n1 and n2 are algebraically equal.
| | ::n1 -ne n2 整数n1、n2が代数的に等しくない場合はtrueとなる。 |
|
| |
|
| n1 -ne n2 True if the integers n1 and n2 are not algebraically equal.
| | ::n1 -gt n2 整数n1が整数n2より代数的に大きい場合にtrueとなる。 |
|
| |
|
| n1 -gt n2 True if the integer n1 is algebraically greater than the integer n2.
| | ::n1 -ge n2 整数n1が整数n2より代数的に大きいか等しい場合に真となる。 |
|
| |
|
| n1 -ge n2 True if the integer n1 is algebraically greater than or equal to the integer n2.
| | ::n1 -lt n2 整数n1が整数n2より代数的に小さい場合に真となる。 |
|
| |
|
| n1 -lt n2 True if the integer n1 is algebraically less than the integer n2.
| | ::n1 -le n2 整数n1が代数的に整数n2より小さいか等しい場合にtrueとなる。 |
|
| |
|
| n1 -le n2 True if the integer n1 is algebraically less than or equal to the integer n2.
| | :これらのプライマリーは、以下の演算子で組み合わせることができる: |
|
| |
|
| These primaries can be combined with the following operators:
| | ::!式がfalseの場合、trueとなる。 |
|
| |
|
| ! expression True if expression is false.
| | ::expression1 -a expression2 |
| | :::expression1 と expression2 の両方が真であればtrueとなる。 |
|
| |
|
| expression1 -a expression2
| | ::expression1 -o expression2 |
| True if both expression1 and expression2 are true.
| | :::expression1 と expression2 のいずれかが真であればtrueとなる。 |
|
| |
|
| expression1 -o expression2
| | ::(expression) 式がtrueであればtrueとする。 |
| True if either expression1 or expression2 are true.
| |
|
| |
|
| (expression) True if expression is true.
| | :-a演算子は-o演算子より優先順位が高い。 |
|
| |
|
| The -a operator has higher precedence than the -o operator.
| | ;times |
| | :シェルおよびシェルから実行されたプロセスの累積ユーザ時間およびシステム時間を表示する。戻りステータスは 0 である。 |
|
| |
|
| times Print the accumulated user and system times for the shell and for processes run from the shell.
| | ;trap [action signal ...] |
| The return status is 0.
| | :指定されたシグナルのいずれかを受信したときに、シェルに解析とアクションの実行を行わせる。シグナルは、シグナル番号またはシグナル名で指定する。 signalが0またはEXITの場合、シェルが終了したときにアクションが実行される。 actionは空('')でもよく、この場合指定されたシグナルは無視される。 actionが省略されるか`-'に設定されると、指定されたシグナルはそのデフォルトのアクションに設定される。 シェルがサブシェルからフォークするとき、トラップされた(しかし無視されない)シグナルをデフォルトのアクションにリセットする。 trapコマンドは、シェルに入ったときに無視されたシグナルには効果がない。引数なしのtrapは、同じトラップ結果を達成するシェルの入力として適した形式で、シグナルのリストとそれに関連するアクションを標準出力に書き出す。 |
|
| |
|
| trap [action signal ...]
| | ::Examples: |
| Cause the shell to parse and execute action when any of the specified signals are received.
| |
| The signals are specified by signal number or as the name of the signal. If signal is 0 or
| |
| EXIT, the action is executed when the shell exits. action may be empty (''), which causes the
| |
| specified signals to be ignored. With action omitted or set to `-' the specified signals are
| |
| set to their default action. When the shell forks off a subshell, it resets trapped (but not
| |
| ignored) signals to the default action. The trap command has no effect on signals that were
| |
| ignored on entry to the shell. trap without any arguments cause it to write a list of signals
| |
| and their associated action to the standard output in a format that is suitable as an input to
| |
| the shell that achieves the same trapping results.
| |
|
| |
|
| Examples:
| | :::trap |
|
| |
|
| trap
| | ::トラップされた信号とそれに対応するアクションをリストアップする |
|
| |
|
| List trapped signals and their corresponding action
| | :::trap '' INT QUIT tstp 30 |
|
| |
|
| trap '' INT QUIT tstp 30
| | ::Ignore signals INT QUIT TSTP USR1 |
|
| |
|
| Ignore signals INT QUIT TSTP USR1
| | :::trap date INT |
|
| |
|
| trap date INT
| | ::Print date upon receiving signal INT |
|
| |
|
| Print date upon receiving signal INT
| | ;type [name ...] |
| | :各名前をコマンドとして解釈し、コマンド検索の解決策を表示する。 可能な解決方法は,シェルキーワード,エイリアス,シェル組み込み,コマンド,追跡されたエイリアス,見つからなかった,である。 エイリアスの場合は,エイリアスの展開が表示され,コマンドと追跡エイリアスの場合は,コマンドの完全なパス名が表示される. |
|
| |
|
| type [name ...]
| | ;ulimit [-H | -S] [-a | -tfdscmlpnv [value]] |
| Interpret each name as a command and print the resolution of the command search. Possible res‐
| | :プロセスのハードリミットやソフトリミットについて問い合わせたり、新たなリミットを設定する。 ハードリミット(どのプロセスも違反することは許されず、一度下げたら上げることはできない)とソフトリミット(プロセスがシグナルを受けるが、必ずしも殺されるわけではなく、上げることができる)の選択は、これらのフラグで行うことができる: |
| olutions are: shell keyword, alias, shell builtin, command, tracked alias and not found. For
| |
| aliases the alias expansion is printed; for commands and tracked aliases the complete pathname
| |
| of the command is printed.
| |
|
| |
|
| ulimit [-H | -S] [-a | -tfdscmlpnv [value]]
| | ::-H ハードリミットをセットあるいは問い合わせる |
| Inquire about or set the hard or soft limits on processes or set new limits. The choice be‐
| |
| tween hard limit (which no process is allowed to violate, and which may not be raised once it
| |
| has been lowered) and soft limit (which causes processes to be signaled but not necessarily
| |
| killed, and which may be raised) is made with these flags:
| |
|
| |
|
| -H set or inquire about hard limits
| | ::-S ソフトリミットを設定または問い合わせる。 -Hも-Sも指定しない場合、ソフトリミットを表示するか、両方のリミットが設定される。 両方が指定された場合、最後に指定されたものが優先される。 |
|
| |
|
| -S set or inquire about soft limits. If neither -H nor -S is specified, the soft
| |
| limit is displayed or both limits are set. If both are specified, the last one
| |
| wins.
| |
|
| |
|
| The limit to be interrogated or set, then, is chosen by specifying any one of these flags:
| | :そして、これらのフラグのいずれかを指定することで、質問または設定するリミットを選択する: |
|
| |
|
| -a show all the current limits
| | ::-a 現在制限されているものを表示する |
|
| |
|
| -t show or set the limit on CPU time (in seconds)
| | ::-t CPU時間の制限を表示または設定する(秒単位)。 |
|
| |
|
| -f show or set the limit on the largest file that can be created (in 512-byte blocks)
| | ::-f 作成できる最大ファイルの上限を表示または設定する(512バイトブロック単位)。 |
|
| |
|
| -d show or set the limit on the data segment size of a process (in kilobytes)
| | ::-d プロセスのデータセグメントサイズの制限を表示または設定する(キロバイト単位)。 |
|
| |
|
| -s show or set the limit on the stack size of a process (in kilobytes)
| | ::-s プロセスのスタックサイズの上限を表示または設定する(キロバイト単位)。 |
|
| |
|
| -c show or set the limit on the largest core dump size that can be produced (in
| | ::-c 生成できる最大のコアダンプサイズの制限を表示または設定する(512バイトブロック単位)。 |
| 512-byte blocks)
| |
|
| |
|
| -m show or set the limit on the total physical memory that can be in use by a process
| | ::-m プロセスが使用できる物理メモリの合計の上限を表示または設定する(キロバイト単位)。 |
| (in kilobytes)
| |
|
| |
|
| -l show or set the limit on how much memory a process can lock with mlock(2) (in kilo‐
| | ::-l プロセスが '''[https://manpages.debian.org/bullseye/manpages-dev/mlock.2.en.html mlock]'''(2) でロックできるメモリの上限を表示または設定する (キロバイト単位)。 |
| bytes)
| |
|
| |
|
| -p show or set the limit on the number of processes this user can have at one time
| | ::-p このユーザーが一度に持つことのできるプロセス数の制限を表示または設定する |
|
| |
|
| -n show or set the limit on the number files a process can have open at once
| | ::-n プロセスが一度に開くことができるファイル数の制限を表示または設定する |
|
| |
|
| -v show or set the limit on the total virtual memory that can be in use by a process
| | ::-v プロセスが使用できる仮想メモリの合計の上限を表示または設定する(キロバイト単位)。 |
| (in kilobytes)
| |
|
| |
|
| -r show or set the limit on the real-time scheduling priority of a process
| | ::-r プロセスのリアルタイムスケジューリング優先度の上限を表示または設定する |
|
| |
|
| If none of these is specified, it is the limit on file size that is shown or set. If value is
| | :これらのいずれもが指定されない場合、表示または設定されるのはファイルサイズの制限値である。 valueが指定されている場合は、その数値が制限値として設定され、そうでない場合は、現在の制限値が表示される。 |
| specified, the limit is set to that number; otherwise the current limit is displayed.
| |
|
| |
|
| Limits of an arbitrary process can be displayed or set using the sysctl(8) utility.
| | :'''[[/usr/sbin/sysctl|sysctl]]'''ユーティリティを用いて、任意のプロセスの制限値を表示・設定することができる。 |
|
| |
|
| umask [mask]
| | ;umask [mask] |
| Set the value of umask (see umask(2)) to the specified octal value. If the argument is omit‐
| | :umask ('''[https://manpages.debian.org/bullseye/manpages-dev/umask.2.en.html umask]'''(2)を参照)の値を、指定された8進数の値に設定する。 引数が省略された場合,umaskの値が表示される。 |
| ted, the umask value is printed.
| |
|
| |
|
| unalias [-a] [name]
| | ;unalias [-a] [name] |
| If name is specified, the shell removes that alias. If -a is specified, all aliases are re‐
| | :nameが指定された場合、シェルはそのエイリアスを削除する。 aが指定された場合、すべてのエイリアスが削除される。 |
| moved.
| |
|
| |
|
| unset [-fv] name ...
| | ;unset [-fv] name ... |
| The specified variables and functions are unset and unexported. If -f or -v is specified, the
| | :指定された変数と関数はアンセットされ、アンエクスポートされる。 -fまたは-vが指定された場合、それぞれ対応する関数または変数が設定解除される。 与えられた名前が変数と関数の両方に対応し、オプションが与えられていない場合、変数のみがアンセットされる。 |
| corresponding function or variable is unset, respectively. If a given name corresponds to both
| |
| a variable and a function, and no options are given, only the variable is unset.
| |
|
| |
|
| wait [job]
| | ;wait [job] |
| Wait for the specified job to complete and return the exit status of the last process in the
| | :指定されたジョブが完了するのを待ち、そのジョブ内の最後のプロセスの終了ステータスを返す。 引数が省略された場合、すべてのジョブの完了を待ち、終了ステータスを0として返す。 |
| job. If the argument is omitted, wait for all jobs to complete and return an exit status of
| |
| zero.
| |
|
| |
|
| === Command Line Editing === | | === Command Line Editing === |
| When dash is being used interactively from a terminal, the current command and the command history
| | dashがターミナルから対話的に使用されている場合、現在のコマンドとコマンド履歴(Builtinsのfcを参照)は、viモードのコマンドライン編集を使用して編集できる。 このモードでは,viのmanページで説明されているコマンドのサブセットに類似した,以下に説明するコマンドを使用する. コマンド''set -o vi''は、vi-mode編集を有効にし、shをvi挿入モードにする。 viモードを有効にすると、shは挿入モードとコマンドモードの間で切り替えることができる。 viと同様で、⟨ESC⟩を打つとviコマンドモードに入る。 コマンドモード中に⟨return⟩を打つと、その行がシェルに渡される。 |
| (see fc in Builtins) can be edited using vi-mode command-line editing. This mode uses commands, de‐
| |
| scribed below, similar to a subset of those described in the vi man page. The command ‘set -o vi’ en‐
| |
| ables vi-mode editing and places sh into vi insert mode. With vi-mode enabled, sh can be switched be‐
| |
| tween insert mode and command mode. It is similar to vi: typing ⟨ESC⟩ enters vi command mode. Hit‐
| |
| ting ⟨return⟩ while in command mode will pass the line to the shell.
| |
|
| |
|
| == EXIT STATUS == | | == EXIT STATUS == |