履歴コマンドの「n」オプションと「r」オプションの違いは何ですか?

履歴コマンドの「n」オプションと「r」オプションの違いは何ですか?

historyコマンドのヘルプページを読み、両方のオプション(nr)を試しました。私が理解しているように、両方のオプションは現在のシェルから履歴ファイルを読み取って有効であることを確認するので、同じことを行います。どう違うのだろうか。

-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

おすすめ記事