/usr/bin/bash: Difference between revisions

Line 1,868: Line 1,868:


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