「glob-expand-word」などのReadline関数に数値引数を提供するにはどうすればよいですか?

「glob-expand-word」などのReadline関数に数値引数を提供するにはどうすればよいですか?

glob-expand-wordデフォルトでは、バインドされたパラメータなどのパラメータをReadline関数にどのように提供しますかC-x *

この場合、カーソルの前の単語にアスタリスクが追加されるように数値引数を指定したいと思います。

man bash:

グローバル拡張ワード(Cx *)

ポイントの前の単語はパス名拡張のためのパターンとして扱われ、一致するファイル名のリストが挿入されて単語が置き換えられます。数値引数が指定されると、パス名拡張の前にアスタリスクが追加されます。

ベストアンサー1

で始まる負の引数を使用して、Readline関数に数値引数を指定できますM-0, M-1,...M--

また、このuniversal-argument関数(オプションでにバインドされていますC-u)(以下を参照)は、関数の後に数値シーケンス(オプションで前にマイナス記号を含む)を実行して、コマンドに数値引数を提供することもできます。

          "\C-u": universal-argument

man bash(抜粋):

   Numeric Arguments
       digit-argument (M-0, M-1, ..., M--)
              Add this digit to the argument already accumulating, or start a new argument.  M-- starts a negative argument.
       universal-argument
              This is another way to specify an argument.  If this command is followed by one or more digits, optionally with a leading minus sign, those digits define the argument.  If the command is  followed  by
              digits,  executing  universal-argument again ends the numeric argument, but is otherwise ignored.  As a special case, if this command is immediately followed by a character that is neither a digit nor
              minus sign, the argument count for the next command is multiplied by four.  The argument count is initially one, so executing this function the first time makes the argument count four, a second  time
              makes the argument count sixteen, and so on.

おすすめ記事