这是bash中的一个错误吗?(向上箭头)

Coa*_*aku 9 linux bash

如我们所知,按向上箭头键可以显示历史命令,但我发现当以空格开头的命令不会显示在"向上箭头"的历史记录中时:

$ls

$(press up arrow key)

bash将显示:

$ls

然而:

$ps

$ ls(notice this command starts with a space)

现在我按向上箭头键,它会显示'ps'而不是'ls':

$ps

这是bash或特定功能中的错误吗?:)

sar*_*old 12

来自bash(1):

   HISTCONTROL
          A colon-separated list of values controlling how
          commands are saved on the history list.  If the list
          of values includes ignorespace, lines which begin with
          a space character are not saved in the history list.
Run Code Online (Sandbox Code Playgroud)

这是一个有意识的功能,可以防止将带有密码或其他私人数据的命令保存到磁盘.(它不会将其排除在ps(1)流程列表之外.)