破折号中的行编辑

Ser*_*nyy 8 command-line dash-shell

有可能的类型化行字一个字,左右移动使用快捷键ESCB

这在不起作用。据我从谷歌搜索中了解到,这与 readline 支持有关,但是我在任何地方都没有看到它提到如何启用对 dash 的支持。

这是我的问题的核心:如何为破折号启用行导航

ΤΖΩ*_*ΙΟΥ 6

如果你肯定想要dash加上命令行编辑和历史记录,你可以使用rlwrap

rlwrap dash
Run Code Online (Sandbox Code Playgroud)

建议:

rlwrap -cmD2 dash
Run Code Online (Sandbox Code Playgroud)

要使用rlwrap,您必须:

sudo apt-get install rlwrap
Run Code Online (Sandbox Code Playgroud)


mur*_*uru 4

简短的回答是:

你不知道。

dash是 Almquist Shell ( ash) 的直接后代。ash从来没有提供行编辑支持,dash. Busyboxash可以,因此如果您ash出于某种原因必须使用变体进行行编辑等,请使用 Busybox ash。没有人会费心添加 readline 支持,因为dash的主要用途是运行 shell 脚本。

当然,除非您愿意在 中编写对 readline 的支持代码dash,并自己维护这样的补丁......

长答案是:

编译用libedit

如果你看一下dash它的联机帮助页

-V vi           Enable the built-in vi(1) command line editor
                (disables -E if it has been set).

-E emacs        Enable the built-in emacs(1) command line editor
                (disables -V if it has been set).
Run Code Online (Sandbox Code Playgroud)

这些仅在dash使用--with-libedit. 在Ubuntu中都不是,显然在 Debian 中也不是。

你可以这样构建它:

git clone https://git.kernel.org/pub/scm/utils/dash/dash.git
cd dash 
./autogen.sh 
./configure --with-libedit 
make
Run Code Online (Sandbox Code Playgroud)

然后运行:

src/dash -E
Run Code Online (Sandbox Code Playgroud)

您应该能够使用箭头键编辑当前命令。