在当前bash命令行中删除整个参数


13

使用^W(unix-word-rubout),我可以轻松地从bash shell中的当前命令中删除单个“单词”。

但是,当处理包含空格的带引号的引数(或包含反斜杠转义的空格的无引号的引数)时,这样做效果不佳,因为它只会删除一个单词而不是整个参数。

因此,我正在寻找一种删除整个参数的方法。

示例(光标始终在末尾):

$ foo --bar "foo bar" meow
[black magic]
$ foo --bar "foo bar"
[black magic]
$ foo --bar
[black magic]
$ foo

是否可以切换到zsh?(我既不知道如何直接在zsh中执行此操作,但是它具有一些行解析器可用于行编辑器(或至少是完成系统)的命令行解析代码,因此应该更轻松。
吉尔(Gilles)'所以

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.