9

I've noticed few settings in .bashrc and .inputrc files look the same or are similar, such as:

shopt -s nocaseglob vs set completion-ignore-case
export HISTSIZE vs set history-size
export HISTFILESIZE vs set history-size

Do .inputrc settings also affect the completion and the history size in python shell (if run inside the terminal)?

Is HISTSIZE limited by history-size or does it override it?

10

From the bash manual:

history-size (unset)

Set the maximum number of history entries saved in the history list. If set to zero, any existing history entries are deleted and no new entries are saved. If set to a value less than zero, the number of history entries is not limited. By default, the number of history entries is set to the value of the HISTSIZE shell variable. If an attempt is made to set history-size to a non-numeric value, the maximum number of history entries will be set to 500.

So if you set HISTSIZE, don't set history-size in .inputrc. The readline library (for which .inputrc is the configuration) does not care what you set HISTFILESIZE to. HISTFILESIZE is the size that the history file ($HISTFILE) is truncated to when a bash shell session exits (by bash, not by the readline library).

According to the question "Is there a way to set the size of the history list in bash to more than 5000 lines?", the history-size setting of the readline library seems to override the HISTSIZE setting in the shell, if both are set.

The nocaseglob shell option is not the same as the completion-ignore-case setting in .inputrc. The shell option is about filename globbing behaviour, while the readline setting has to do with filename completion (when you press Tab on the command line).

The .inputrc settings affect all programs that uses the readline library, not just bash.

bash may be started without readline support by invoking it with the --noediting flag.


Note that both HISTSIZE and HISTFILESIZE are shell variables, not environment variables, and therefore do not need to be exported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.