相关疑难解决方法(0)

bash 中的多行历史条目(又名 lithist)何时可能?

bash 参考手册中,它指出:

lithist 如果启用并启用该cmdhist选项,多行命令将使用嵌入的换行符保存到历史记录中,而不是在可能的情况下使用分号分隔符。

因此我的问题是:这在哪里/何时/如何可能

我尝试在我的GNU bash 版本 4.4.12(1)-release上启用和测试该功能这样做:

shopts -s cmdhist
shopts -s lithist
echo -n "this is a test for a ";\
echo "multiline command"
Run Code Online (Sandbox Code Playgroud)

然后我做了一个

history | tail 
Run Code Online (Sandbox Code Playgroud)

期待一些类似于此的输出:

101 shopts -s cmdlist
102 shopts -s lithist
103 echo -n "this is a test for a ";\
    echo "multiline command"
104 history
Run Code Online (Sandbox Code Playgroud)

而是得到这个:

101 shopts -s cmdlist
102 shopts -s lithist
103 echo -n "this is a …
Run Code Online (Sandbox Code Playgroud)

bash command-history shopt

10
推荐指数
1
解决办法
1595
查看次数

标签 统计

bash ×1

command-history ×1

shopt ×1