/usr/bin/bash: Difference between revisions

Line 1,394: Line 1,394:


=== Readline Variables ===
=== Readline Variables ===
      Readline has variables that can be used to further customize its behavior.  A variable may be set
Readlineには、その動作をさらにカスタマイズするために使用できる変数がある。 変数は、inputrcファイルに次のような形式で設定することができる。
      in the inputrc file with a statement of the form
:set variable-name value
またはbind組み込みコマンドを使用する(下記の「[[#SHELL BUILTIN COMMANDS|SHELL BUILTIN COMMANDS ]]」を参照)。


              set variable-name value
注意書きがある場合を除き、readline変数は(大文字小文字を区別せずに)OnまたはOffの値を取ることができる。認識できない変数名は無視される。 変数の値が読み込まれるとき、空またはヌル値、"on"(大文字小文字を区別しない)、"1 "は On と等価である。 その他の値はすべて Off と同じである。変数とそのデフォルト値は以下の通りである:
      or using the bind builtin command (see SHELL BUILTIN COMMANDS below).


      Except  where  noted,  readline variables can take the values On or Off (without regard to case).
;bell-style (audible)
      Unrecognized variable names are ignored.  When a variable value is read, empty  or  null  values,
:readlineが端末のベルを鳴らそうとするときの動作を制御する。 noneに設定すると、readlineはベルを鳴らさない。 visible に設定すると、readline はベルがあればそれを使う。 audibleに設定すると、readlineは端末のベルを鳴らそうとする。
      "on"  (case-insensitive),  and "1" are equivalent to On.  All other values are equivalent to Off.
;bind-tty-special-chars (On)
      The variables and their default values are:
:Onに設定すると、readlineは、カーネルの端末ドライバで特別に扱われる制御文字を、readlineに相当する文字にバインドしようとする。
 
;blink-matching-paren (Off)
      bell-style (audible)
:Onに設定すると、readlineは、閉じ括弧が挿入されたときに、カーソルを開始括弧に短時間移動させようとする。
              Controls what happens when readline wants to ring the terminal bell.  If  set  to  none,
;colored-completion-prefix (Off)
              readline  never rings the bell.  If set to visible, readline uses a visible bell if one is
:Onに設定すると、補完候補を一覧表示する際に、readlineは補完候補の共通接頭辞を別の色で表示する。 色の定義は'''LS_COLORS'''環境変数の値から取られる。
              available.  If set to audible, readline attempts to ring the terminal's bell.
;colored-stats (Off)
      bind-tty-special-chars (On)
:Onに設定すると、readlineは、ファイルの種類を示すために、可能性のある補完を異なる色で表示する。 色の定義は、'''LS_COLORS'''環境変数の値から取られる。
              If set to On, readline attempts to bind the control characters treated  specially  by  the
;comment-begin (``#'')
              kernel's terminal driver to their readline equivalents.
:readline insert-commentコマンド実行時に挿入される文字列。 このコマンドはemacsモードではM-#に、viコマンドモードでは#にバインドされる。
      blink-matching-paren (Off)
;completion-display-width (-1)
              If  set to On, readline attempts to briefly move the cursor to an opening parenthesis when
:補完を実行するときに、マッチする可能性のあるものを表示するために使われる画面の列数。この値が 0 より小さいか、端末の画面幅より大きい場合は無視される。 0を指定すると、マッチは1行に1つずつ表示される。 デフォルト値は -1 である。
              a closing parenthesis is inserted.
;completion-ignore-case (Off)
      colored-completion-prefix (Off)
:Onに設定すると、readlineは大文字小文字を区別せずにファイル名のマッチングと補完を行う。
              If set to On, when listing completions, readline displays the common prefix of the set  of
;completion-map-case (Off)
              possible  completions  using  a different color.  The color definitions are taken from the
:Onに設定し、補完-大文字小文字を区別しないを有効にすると、大文字小文字を区別しないファイル名のマッチングと補完を行う際に、readlineはハイフン(-)とアンダースコア(_)を等価なものとして扱う。
              value of the LS_COLORS environment variable.
;completion-prefix-display-length (0)
      colored-stats (Off)
:補完可能リストをそのまま表示する場合の、共通接頭辞の文字数。 ゼロより大きい値に設定すると、この値より長い共通接頭辞は、可能な補完を表示する際に省略記号に置き換えられる。
              If set to On, readline displays possible completions using different  colors  to  indicate
;completion-query-items (100)
              their file type.  The color definitions are taken from the value of the LS_COLORS environ‐
:これは、possible-completionsコマンドによって生成された可能な完了の数の表示について、ユーザーに問い合わせがあったときに決定する。 0以上の任意の整数値を設定することができる。 可能な補完の数がこの変数の値以上であれば、readlineはユーザーがそれらを表示したいかどうかを尋ねる。
              ment variable.
;convert-meta (On)
      comment-begin (``#'')
:Onに設定すると、readlineは8ビット目が設定された文字をASCIIキーシーケンスに変換し、8ビット目を除去してエスケープ文字を先頭に付ける(事実上、エスケープをメタプレフィックスとして使用する)。 デフォルトはOnであるが、ロケールに8ビット文字が含まれている場合、readlineはこれをOffに設定する。
              The string that is inserted when the readline insert-comment command is  executed.  This
;disable-completion (Off)
              command is bound to M-# in emacs mode and to # in vi command mode.
:Onに設定すると、readlineは単語の補完を禁止する。 補完文字は、あたかも自己挿入にマップされているかのように行に挿入される。
      completion-display-width (-1)
;echo-control-characters (On)
              The  number of screen columns used to display possible matches when performing completion.
:Onに設定すると、サポートしていることを示すオペレーティング・システム上で、readlineはキーボードから生成された信号に対応する文字をエコーする。
              The value is ignored if it is less than 0 or greater than the terminal  screen width.  A
;editing-mode (emacs)
              value of 0 will cause matches to be displayed one per line.  The default value is -1.
:editing-modeはemacsかviのどちらかに設定できる。
      completion-ignore-case (Off)
;emacs-mode-string (@)
              If  set  to  On,  readline performs filename matching and completion in a case-insensitive
:show-mode-in-prompt変数が有効な場合、emacs編集モードが有効なとき、この文字列はプライマリプロンプトの最終行の直前に表示される。 この値はキーバインディングのように展開されるので、標準的なメタプレフィックスとコントロールプレフィックス、バックスラッシュエスケープシーケンスのセットが利用できる。 印刷されない文字のシーケンスの開始と終了には、"emacs1 "と "emacs2 "エスケープを使用し、端末制御シーケンスをモード文字列に埋め込むことができる。
              fashion.
;enable-bracketed-paste (On)
      completion-map-case (Off)
:Onに設定すると、readlineは、ペーストされた各文字をキーボードから読み込んだものとして扱うのではなく、1つの文字列として編集バッファに挿入できるように端末を設定する。 これにより、ペーストされた文字が編集コマンドとして解釈されるのを防ぐことができる。
              If set to On, and completion-ignore-case is enabled, readline treats hyphens (-) and  un‐
;enable-keypad (Off)
              derscores (_) as equivalent when performing case-insensitive filename matching and comple‐
:Onに設定すると、readlineが呼び出されたときに、アプリケーションのキーパッドを有効にしようとする。システムによっては、矢印キーを有効にするためにこれが必要である。
              tion.
;enable-meta-key (On)
      completion-prefix-display-length (0)
:Onに設定すると、readlineが呼び出されたときに、端末がサポートしていると主張するメタ修飾キーを有効にしようとする。 多くの端末では、メタ・キーは8ビット文字の送信に使われる。
              The length in characters of the common prefix of a list of possible completions  that  is
;expand-tilde (Off)
              displayed  without  modification.  When set to a value greater than zero, common prefixes
:Onに設定すると、readlineが単語補完を試みる際にチルダ展開が行われる。
              longer than this value are replaced with an ellipsis when displaying possible completions.
;history-preserve-point (Off)
      completion-query-items (100)
:Onに設定されている場合、ヒストリーコードは、previous-historyまたはnext-historyで検索された各ヒストリー行の同じ位置にポイントを配置しようとする。
              This determines when the user is queried about viewing the number of possible  completions
;history-size (unset)
              generated by the possible-completions command.  It may be set to any integer value greater
:履歴リストに保存される履歴エントリーの最大数を設定する。 ゼロに設定した場合、既存の履歴エントリーはすべて削除され、 新しいエントリーは保存されない。 ゼロ未満の値を設定すると、ヒストリエントリの数は制限されない。 デフォルトでは、ヒストリエントリ数はシェル変数HISTSIZEの値に設定される。 history-sizeに数値以外の値を設定しようとすると、ヒストリエントリの最大数は500に設定される。
              than or equal to zero.  If the number of possible completions is greater than or equal  to
;horizontal-scroll-mode (Off)
              the value of this variable, readline will ask whether or not the user wishes to view them;
:Onに設定すると、readlineは1行で表示するようになり、入力が画面幅より長くなると、改行するのではなく、画面1行で水平方向にスクロールするようになる。 この設定は、高さ1の端末では自動的に有効になる。
              otherwise they are simply listed on the terminal.
;input-meta (Off)
      convert-meta (On)
:Onに設定された場合、readlineは8ビット入力を有効にする(つまり、読み取った文字から8ビット目を取り除かない)。meta-flagという名前は、この変数の同義語である。 デフォルトはOffであるが、ロケールに8ビット文字が含まれている場合、readlineはこれをOnに設定する。
              If set to On, readline will convert characters with the eighth bit set to an ASCII key se‐
;isearch-terminators <nowiki>(``C-[C-J'')</nowiki>
              quence by stripping the eighth bit and prefixing an escape character (in effect, using es‐
:その文字をコマンドとして実行せずにインクリメンタルサーチを終了させる文字列。 この変数に値が与えられていない場合、文字 ESC C-J がインクリメンタルサーチを終了する。
              cape as the meta prefix).  The default is On, but readline will set it to Off if  the  lo‐
;keymap (emacs)
              cale contains eight-bit characters.
:現在のreadlineキーマップを設定する。 有効なキーマップ名は、emacs、emacs-standard、 emacs-meta、emacs-ctlx、vi、vi-command、vi-insertである。 デフォルト値はemacsである。editing-modeの値はデフォルトのキーマップにも影響する。
      disable-completion (Off)
;keyseq-timeout (500)
              If  set  to  On, readline will inhibit word completion.  Completion characters will be in‐
:曖昧なキーシーケンス(これまでに読み込まれた入力を使って完全なキーシーケンスを形成できるもの、または、より長いキーシーケンスを完成させるために追加入力を必要とするもの)を読み込む際に、readlineが文字を待つ時間を指定する。 タイムアウト時間内に入力がない場合、readlineは短いが完全なキーシーケンスを使用する。 値はミリ秒単位で指定されるので、1000という値は、readlineが追加入力を1秒待つことを意味する。 この変数に0以下の値、または数値以外の値が設定された場合、readlineは他のキーが押されるまで待ち、どのキーシーケンスを完了させるかを決定する。
              serted into the line as if they had been mapped to self-insert.
;mark-directories (On)
      echo-control-characters (On)
:Onに設定すると、完成したディレクトリ名にスラッシュが付加される。
              When set to On, on operating systems that indicate they  support  it,  readline  echoes  a
;mark-modified-lines (Off)
              character corresponding to a signal generated from the keyboard.
:Onに設定すると、変更されたヒストリー行は、その前にアスタリスク(*)をつけて表示される。
      editing-mode (emacs)
;mark-symlinked-directories (Off)
              Controls whether readline begins with a set of key bindings similar to Emacs or vi.  edit‐
:Onに設定すると、ディレクトリへのシンボリックリンクである完了した名前にスラッシュが付加される(mark-directoriesの値に従う)。
              ing-mode can be set to either emacs or vi.
;match-hidden-files (On)
      emacs-mode-string (@)
:この変数を On に設定すると、readline がファイル名補完を行うときに、ファイル名が `.' で始まるファイル (隠しファイル) にマッチするようになる。 Offに設定すると、補完するファイル名の先頭の `.' はユーザーが与えなければならない。
              If the show-mode-in-prompt variable is enabled, this string is displayed  immediately  be‐
;menu-complete-display-prefix (Off)
              fore  the last line of the primary prompt when emacs editing mode is active.  The value is
:Onに設定すると、メニュー補完は、リストを循環する前に、補完可能なリストの共通接頭辞(空でもよい)を表示する。
              expanded like a key binding, so the standard set of meta- and control prefixes  and  back‐
;output-meta (Off)
              slash escape sequences is available.  Use the \1 and \2 escapes to begin and end sequences
:Onに設定すると、readlineはメタ接頭辞付きエスケープシーケンスとしてではなく、8ビット目が直接設定された文字を表示する。 デフォルトはOffであるが、ロケールに8ビット文字が含まれている場合、readlineはこれをOnに設定する。
              of non-printing characters, which can be used to embed a terminal  control  sequence  into
;page-completions (On)
              the mode string.
:Onに設定すると、readlineは内部のmore-likeページャーを使って、一度に画面いっぱいの完了候補を表示する。
      enable-bracketed-paste (On)
;print-completions-horizontally (Off)
              When  set  to On, readline will configure the terminal in a way that will enable it to in‐
:Onに設定すると、readlineは、マッチした選手を画面の下ではなく、アルファベット順に水平にソートして表示する。
              sert each paste into the editing buffer as a  single  string  of  characters,  instead  of
;revert-all-at-newline (Off)
              treating each character as if it had been read from the keyboard.  This can prevent pasted
:Onに設定すると、readlineはaccept-lineが実行されたときに戻る前に、履歴行のすべての変更を取り消す。 デフォルトでは、履歴行は変更される可能性があり、readlineの呼び出しにまたがって個々の取り消しリストを保持する。
              characters from being interpreted as editing commands.
;show-all-if-ambiguous (Off)
      enable-keypad (Off)
:これは補完関数のデフォルトの動作を変更する。 Onに設定すると、複数の補完候補がある単語は、ベルを鳴らす代わりに、マッチした単語を即座にリストアップする。
              When set to On, readline will try to enable the application  keypad  when  it  is  called.
;show-all-if-unmodified (Off)
              Some systems need this to enable the arrow keys.
:これはshow-all-if-ambiguousに似た方法で、補完関数のデフォルトの動作を変更する。 Onに設定すると、部分補完の可能性がなく(補完の可能性が共通の接頭辞を持たない)、複数の補完の可能性がある単語は、ベルを鳴らす代わりに、マッチした単語を即座にリストアップする。
      enable-meta-key (On)
;show-mode-in-prompt (Off)
              When  set  to On, readline will try to enable any meta modifier key the terminal claims to
:Onに設定された場合、編集モードを示す文字列をプロンプトの先頭に追加する: emacs、viコマンド、vi挿入。 モード文字列は、ユーザー設定可能である(例えば、emacs-mode-string)
              support when it is called.  On many terminals, the meta key  is  used  to  send  eight-bit
;skip-completed-text (Off)
              characters.
:Onに設定すると、単一一致を行に挿入する際のデフォルトの補完動作を変更する。 単語の途中で補完を行う場合にのみ有効である。 有効にすると、readlineは補完された文字が、補完された単語内のポイント以降の文字にマッチしても挿入しないので、カーソルに続く単語の一部が重複しない。
      expand-tilde (Off)
;vi-cmd-mode-string ((cmd))
              If set to On, tilde expansion is performed when readline attempts word completion.
:show-mode-in-prompt変数が有効な場合、この文字列は、vi編集モードが有効でコマンドモードのとき、プライマリプロンプトの最終行の直前に表示される。 この値は、キーバインディングのように展開されるので、標準的なメタとコントロールの接頭辞とバックスラッシュエスケープシーケンスのセットが利用できる。 非印字文字のシーケンスの開始と終了には、"˶1 "と"˶2 "エスケープを使用する。"˶1 "と"˶2 "エスケープは、端末制御シーケンスをモード文字列に埋め込むために使用できる。
      history-preserve-point (Off)
;vi-ins-mode-string ((ins))
              If  set  to On, the history code attempts to place point at the same location on each his‐
:show-mode-in-prompt変数が有効な場合、この文字列は、vi編集モードが有効で挿入モードのとき、主プロンプトの最終行の直前に表示される。 この値は、キーバインディングのように展開されるので、標準的なメタとコント ロール接頭辞のセットとバックスラッシュ・エスケープ・シーケンスが利用できる。 非印字文字のシーケンスの開始と終了には、ⅳ1とⅳ2エスケープを使用する。
              tory line retrieved with previous-history or next-history.
;visible-stats (Off)
      history-size (unset)
:On に設定すると、 [https://manpages.debian.org/unstable/manpages-dev/stat.2.en.html stat](2) が報告するファイルのタイプを示す文字が、 補完の可能性をリストする際にファイル名に付加される。
              Set the maximum number of history entries saved in the history list.  If set to zero,  any
              existing history entries are deleted and no new entries are saved.  If set to a value less
              than zero, the number of history entries is not limited.  By default, the number  of  his‐
              tory entries is set to the value of the HISTSIZE shell variable.  If an attempt is made to
              set history-size to a non-numeric value, the maximum number of history entries will be set
              to 500.
      horizontal-scroll-mode (Off)
              When set to On, makes readline use a single line for display, scrolling the input horizon‐
              tally on a single screen line when it becomes longer than the  screen  width  rather  than
              wrapping to a new line.  This setting is automatically enabled for terminals of height 1.
      input-meta (Off)
              If  set to On, readline will enable eight-bit input (that is, it will not strip the eighth
              bit from the characters it reads), regardless of what the terminal claims it can  support.
              The  name meta-flag is a synonym for this variable.  The default is Off, but readline will
              set it to On if the locale contains eight-bit characters.
      isearch-terminators (``C-[C-J'')
              The string of characters that should terminate an incremental search without  subsequently
              executing  the  character  as a command.  If this variable has not been given a value, the
              characters ESC and C-J will terminate an incremental search.
      keymap (emacs)
              Set the current readline keymap.  The set of valid keymap names is emacs,  emacs-standard,
              emacs-meta,  emacs-ctlx,  vi,  vi-command, and vi-insert.  vi is equivalent to vi-command;
              emacs is equivalent to emacs-standard.  The default value is emacs; the  value  of  edit‐
              ing-mode also affects the default keymap.
      keyseq-timeout (500)
              Specifies  the  duration  readline will wait for a character when reading an ambiguous key
              sequence (one that can form a complete key sequence using the input read so  far,  or  can
              take  additional input to complete a longer key sequence).  If no input is received within
              the timeout, readline will use the shorter but complete key sequence.  The value is speci‐
              fied  in milliseconds, so a value of 1000 means that readline will wait one second for ad‐
              ditional input.  If this variable is set to a value less than or equal to zero,  or  to  a
              non-numeric value, readline will wait until another key is pressed to decide which key se‐
              quence to complete.
      mark-directories (On)
              If set to On, completed directory names have a slash appended.
      mark-modified-lines (Off)
              If set to On, history lines that have been modified are displayed with a preceding  aster‐
              isk (*).
      mark-symlinked-directories (Off)
              If  set  to  On,  completed names which are symbolic links to directories have a slash ap‐
              pended (subject to the value of mark-directories).
      match-hidden-files (On)
              This variable, when set to On, causes readline to match files whose names begin with a `.'
              (hidden  files) when performing filename completion.  If set to Off, the leading `.' must
              be supplied by the user in the filename to be completed.
      menu-complete-display-prefix (Off)
              If set to On, menu completion displays the common prefix of the list of  possible  comple‐
              tions (which may be empty) before cycling through the list.
      output-meta (Off)
              If  set  to  On,  readline will display characters with the eighth bit set directly rather
              than as a meta-prefixed escape sequence.  The default is Off, but readline will set it  to
              On if the locale contains eight-bit characters.
      page-completions (On)
              If set to On, readline uses an internal more-like pager to display a screenful of possible
              completions at a time.
      print-completions-horizontally (Off)
              If set to On, readline will display completions with matches sorted horizontally in alpha‐
              betical order, rather than down the screen.
      revert-all-at-newline (Off)
              If  set  to  On, readline will undo all changes to history lines before returning when ac‐
              cept-line is executed.  By default, history lines may be modified  and  retain  individual
              undo lists across calls to readline.
      show-all-if-ambiguous (Off)
              This  alters  the default behavior of the completion functions.  If set to On, words which
              have more than one possible completion cause the matches to be listed immediately  instead
              of ringing the bell.
      show-all-if-unmodified (Off)
              This  alters  the  default  behavior  of  the completion functions in a fashion similar to
              show-all-if-ambiguous.  If set to On, words which have more than one  possible  completion
              without  any  possible  partial  completion (the possible completions don't share a common
              prefix) cause the matches to be listed immediately instead of ringing the bell.
      show-mode-in-prompt (Off)
              If set to On, add a string to the beginning of the prompt  indicating  the  editing  mode:
              emacs,  vi  command,  or  vi  insertion.  The  mode  strings  are  user-settable (e.g.,
              emacs-mode-string).
      skip-completed-text (Off)
              If set to On, this alters the default completion behavior when inserting  a  single  match
              into  the  line.  It's only active when performing completion in the middle of a word.  If
              enabled, readline does not insert characters from the completion that match characters af‐
              ter  point  in  the word being completed, so portions of the word following the cursor are
              not duplicated.
      vi-cmd-mode-string ((cmd))
              If the show-mode-in-prompt variable is enabled, this string is displayed  immediately  be‐
              fore  the  last  line  of the primary prompt when vi editing mode is active and in command
              mode.  The value is expanded like a key binding, so the standard set of meta- and  control
              prefixes  and backslash escape sequences is available.  Use the \1 and \2 escapes to begin
              and end sequences of non-printing characters, which can be used to embed a  terminal  con‐
              trol sequence into the mode string.
      vi-ins-mode-string ((ins))
              If  the  show-mode-in-prompt variable is enabled, this string is displayed immediately be‐
              fore the last line of the primary prompt when vi editing mode is active and  in insertion
              mode.  The value is expanded like a key binding, so the standard set of meta- and control
              prefixes and backslash escape sequences is available.  Use the \1 and \2 escapes to  begin
              and  end  sequences of non-printing characters, which can be used to embed a terminal con‐
              trol sequence into the mode string.
      visible-stats (Off)
              If set to On, a character denoting a file's type as reported by stat(2) is appended to the
              filename when listing possible completions.


=== Readline Conditional Constructs ===
=== Readline Conditional Constructs ===