我已阅读history
命令帮助页面并尝试了这两个选项(n
& r
)。据我了解,这两个选项都确保历史文件在当前 shell 中被读取并且有效,因此它执行相同的操作。我想知道它有何不同?
-n Append the history lines not already read from the history file
to the current history list. These are lines appended to the
history file since the beginning of the current Bash session.
-r Read the current history file and append its contents to the history list.
答案1
附加-r
整个文件,-n
仅附加自会话开始以来添加到其中的行。