HISTSIZE と HISTFILESIZE が設定されていない場合でも、Bash の記録は切り捨てられます。

HISTSIZE と HISTFILESIZE が設定されていない場合でも、Bash の記録は切り捨てられます。

私はそれを使用していますこれ2年間.bashrc、最近まで何の問題も発見したことがありません。

.bash_eternal_history新しくログインすると、40,000を超える行が突然切り捨てられ、数百行に減ったことがわかりました。

確認しようとしましたが、まだ何も返しません。 (制限がないという意味のようです。HISTSIZEHISTFILESIZE

私は他人を知っています郵便はがきこれらの変数に言及した方が好まれますが、unset他の場合は一つ、いつもそうではないようです。

私は次の選択肢を見つけました(まだ試していません)これ一つ。

私は既にデフォルトの一部であるため、Ubuntuのデフォルトを使用しており、.bashrcコメントHISTSIZEHISTFILESIZE付けました(上記のコードの断片を妨げないように)。

私が確認した他の関連投稿:

上記の回避策を試したことがないので、上記の記事で見つけた以外に、このようなことが発生する他の理由があるかどうか疑問に思います。

ベストアンサー1

からman bash

   HISTFILESIZE
          The maximum number of lines  contained  in  the  history  file.
          When  this  variable  is  assigned a value, the history file is
          truncated, if necessary, to contain no more than that number of
          lines by removing the oldest entries.  The history file is also
          truncated to this size after writing it when a shell exits.  If
          the  value  is  0,  the history file is truncated to zero size.
          Non-numeric values and numeric values less  than  zero  inhibit
          truncation.   The  shell sets the default value to the value of
          HISTSIZE after reading any startup files.
   HISTSIZE
          The  number of commands to remember in the command history (see
          HISTORY below).  If the value is 0, commands are not  saved  in
          the  history list.  Numeric values less than zero result in ev‐
          ery command being saved  on  the  history  list  (there  is  no
          limit).   The shell sets the default value to 500 after reading
          any startup files.

したがって、両方が設定されていない場合でも、コードはまだデフォルトの500に設定されます。

おすすめ記事