bash命令history -r有什么作用?

问题描述 投票:0回答:2

history -r
的目的是什么?鉴于手册页中的内容:

r      Remove a trailing suffix of the form .xxx, leaving the basename.
linux bash history
2个回答
1
投票

来自文档

读取历史文件并将其内容追加到历史列表中。

可以使用 History 命令将自定义文件加载到 Bash 历史记录中。现在,当您使用

history -r
时,它将读取您命名的文件作为命令历史记录。


1
投票

正如 Rahul Tripathi 所说,

history -r
用于将文件读入历史记录。

有关

r
和尾随后缀的内容来自手册页的
Modifiers
部分,指的是在历史扩展中的单词指示符之后使用
r
,如下所示:

$ echo foo.bar
foo.bar
$ echo !$:r
foo
© www.soinside.com 2019 - 2024. All rights reserved.