/usr/bin/dash: Difference between revisions

Line 340: Line 340:


=== 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 ===