bash 内嵌大括号扩展

eli*_*lig 4 bash readline brace-expansion

bash/readline 是否有一个绑定或一个可以绑定组合键以扩展内嵌大括号的函数?类似于M-* key组合方式可用于内联通配扩展。

所以在执行组合键时

$ {a..z}

将变成:

$ a b c d e f g h i j k l m n o p q r s t u v w x y z

eli*_*lig 8

$ $(echo {a..z})
Run Code Online (Sandbox Code Playgroud)

CTRL+ ALT+e

$ a b c d e f g h i j k l m n o p q r s t u v w x y z
Run Code Online (Sandbox Code Playgroud)

请注意,它将扩展命令行上的所有扩展。不管光标放在哪里。
使用此命令(和a=this; b=that):

$ echo "$a"; $(echo {a..m}); echo "$b"
Run Code Online (Sandbox Code Playgroud)

这将被扩展:

$ echo this; a b c d e f g h i j k l m ; echo that
Run Code Online (Sandbox Code Playgroud)

来自man bash

shell-expand-line (MCe)
像 shell 一样扩展该行。这将执行别名和历史扩展以及所有 shell 单词扩展。有关历史扩展的说明,请参阅下面的 HISTORY EXPANSION。