If the `history' builtin is used with no filename argument and the HISTFILE
variable is unset, the Readline default history file ~/.history is used.

$ rm -f ~/.history
$ bash -c 'history -s foo; history -w'
$ cat ~/.history
foo

The help text states:

    If FILENAME is given, it is used as the history file.  Otherwise,
    if HISTFILE has a value, that is used, else ~/.bash_history.

The man and info pages both just state that if no filename supplied then
"the value of HISTFILE is used."

Since Bash normally doesn't perform any history file operations if HISTFILE
is empty or unset, I think it would make sense for `history' to do the same.


I think there's also some ambiguity in the documentation regarding an empty
HISTFILE value:

       HISTFILE
              The name of the file in which command history is saved (see HIS-
              TORY below).  The default value is ~/.bash_history.   If  unset,
              the command history is not saved when a shell exits.

It might be nice to be explicit here, and in the HISTORY section, that an empty
HISTFILE is treated the same as an unset one, and/or clarify that the "default
value" is what the variable is set to on shell startup if it is unset.

Reply via email to