/usr/bin/bash: Difference between revisions

Line 1,342: Line 1,342:


=== Readline Key Bindings ===
=== Readline Key Bindings ===
      The  syntax  for controlling key bindings in the inputrc file is simple.  All that is required is
inputrcファイルでキーバインドを制御する構文は簡単である。 必要なのは、コマンド名またはマクロのテキストと、それをバインドするキー配列だけである。
      the name of the command or the text of a macro and a key sequence to which it  should  be  bound.
名前は2つの方法で指定できる。1つはシンボリックなキー名で、Meta-またはControl-という接頭辞をつけることもできるし、もう1つはキー配列である。
      The name may be specified in one of two ways: as a symbolic key name, possibly with Meta- or Con‐
      trol- prefixes, or as a key sequence.


      When using the form keyname:function-name or macro, keyname is the name of a key spelled  out  in
keyname:function-nameまたはmacroという形式を使う場合、keynameは英語で綴られたキーの名前である。 例えば:
      English.  For example:


<code>
               Control-u: universal-argument
               Control-u: universal-argument
               Meta-Rubout: backward-kill-word
               Meta-Rubout: backward-kill-word
               Control-o: "> output"
               Control-o: "> output"
</code>


      In  the  above  example,  C-u  is bound to the function universal-argument, M-DEL is bound to the
上記の例では、C-uは関数universal-argumentに、M-DELは関数backward-kill-wordに、C-oは右辺で表現されたマクロを実行する(つまり、テキスト``> output''を行に挿入する)ためにバインドされている。
      function backward-kill-word, and C-o is bound to run the macro expressed on the right  hand  side
      (that is, to insert the text ``> output'' into the line).


      In  the  second  form, "keyseq":function-name or macro, keyseq differs from keyname above in that
2番目の形式である "keyseq":function-nameまたはmacroでは、keyseqは上記のkeynameとは異なり、キーシーケンス全体を表す文字列を二重引用符で囲んで指定することができる。 以下の例のように、GNU Emacsスタイルのキーエスケープを使うことができるが、記号文字名は認識されない。
      strings denoting an entire key sequence may be specified by placing the  sequence  within double
      quotes.  Some GNU Emacs style key escapes can be used, as in the following example, but the sym‐
      bolic character names are not recognized.


<code>
               "\C-u": universal-argument
               "\C-u": universal-argument
               "\C-x\C-r": re-read-init-file
               "\C-x\C-r": re-read-init-file
               "\e[11~": "Function Key 1"
               "\e[11~": "Function Key 1"
</code>


      In this example, C-u is again bound to the function universal-argument.  C-x C-r is bound to  the
この例では、C-uは再び関数universal-argumentにバインドされている。 C-x C-rは関数re-read-init-fileに束縛され、<nowiki>ESC [ 1 1 ~</nowiki>はテキスト``Function Key 1''を挿入するために束縛される。
      function re-read-init-file, and ESC [ 1 1 ~ is bound to insert the text ``Function Key 1''.


      The full set of GNU Emacs style escape sequences is
GNU Emacsスタイルのエスケープシーケンス一式は以下の通りである。
<code>
               \C-    control prefix
               \C-    control prefix
               \M-    meta prefix
               \M-    meta prefix
Line 1,377: Line 1,373:
               \"    literal "
               \"    literal "
               \'    literal '
               \'    literal '
</code>


      In  addition to the GNU Emacs style escape sequences, a second set of backslash escapes is avail‐
GNU Emacsスタイルのエスケープシーケンスに加えて、2つ目のバックスラッシュエスケープのセットが利用できる:
      able:
<code>
               \a    alert (bell)
               \a    alert (bell)
               \b    backspace
               \b    backspace
Line 1,389: Line 1,386:
               \v    vertical tab
               \v    vertical tab
               \nnn  the eight-bit character whose value is the octal value nnn (one to three digits)
               \nnn  the eight-bit character whose value is the octal value nnn (one to three digits)
               \xHH  the eight-bit character whose value is the hexadecimal value HH  (one  or  two  hex
               \xHH  the eight-bit character whose value is the hexadecimal value HH  (one  or  two  hex digits)
                    digits)
</code>


      When entering the text of a macro, single or double quotes must be used to indicate a macro defi‐
マクロのテキストを入力する際には、マクロ定義を示すために一重引用符または二重引用符を使用しなければならない。 引用符で囲まれていないテキストは関数名とみなされる。 マクロ本文では、前述のバックスラッシュエスケープが展開される。 バックスラッシュは、" ' を含め、マクロテキスト内の他の文字を引用符で囲む。
      nition.  Unquoted text is assumed to be a function name.  In the macro body,  the  backslash  es‐
      capes  described above are expanded.  Backslash will quote any other character in the macro text,
      including " and '.


      Bash allows the current readline key bindings to be displayed or modified with the bind  builtin
Bashでは、bind組み込みコマンドを使用して、現在のreadlineキーバインディングを表示または変更できる。 編集モードは、set builtinコマンドの-oオプションを使用することで、インタラクティブな使用中に切り替えることができる(後述の「[[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]」を参照)。
      command.  The  editing mode may be switched during interactive use by using the -o option to the
      set builtin command (see SHELL BUILTIN COMMANDS below).


=== Readline Variables ===
=== Readline Variables ===