"unset HISTFILESIZE" not working in .bashrc
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: freebsd6.1 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='freebsd6.1' -DCONF_MACHTYPE='i386-portbld-freebsd6.1' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -I/usr/local/include -O2 -fno-strict-aliasing -pipe uname output: FreeBSD fbsd61 6.1-RELEASE FreeBSD 6.1-RELEASE #30: Mon Jan 1 23:01:34 PST 2007 per...@fbsd61:/usr/src/sys/i386/compile/GENERIC i386 Machine Type: i386-portbld-freebsd6.1 Bash Version: 3.1 Patch Level: 10 Release Status: release Description: I'm not sure whether this is a bug, or something that I don't understand. I added these lines to ~/.bashrc: echo this is .bashrc unset HISTFILESIZE and started a new xterm. It did report "this is .bashrc" before giving the first prompt, so I know that it did read the new ~/.bashrc, but it seems that either the "unset HISTFILESIZE" was ignored or something set it to the default value after ~/.bashrc had been read. I then entered ". .bashrc" so that .bashrc would be read again, and this time the unset worked as expected. Should I be using some other method to unset HISTFILESIZE? The xterm shows: this is .bashrc [per...@fbsd61 /usr/home/perryh]$ echo $HISTFILESIZE 500 [per...@fbsd61 /usr/home/perryh]$ . .bashrc this is .bashrc [per...@fbsd61 /usr/home/perryh]$ echo $HISTFILESIZE [per...@fbsd61 /usr/home/perryh]$ bash --version GNU bash, version 3.1.10(1)-release (i386-portbld-freebsd6.1) Copyright (C) 2005 Free Software Foundation, Inc.
Re: "unset HISTFILESIZE" not working in .bashrc
Chet Ramey wrote: > HISTFILESIZE doesn't exist until bash tries to load the history > list from the history file (taken from $HISTFILE). At that point, > if it doesn't have a value, it's set to $HISTSIZE. That doesn't > happen until after the startup files are read, as you guessed. > > If you want to avoid history file truncation, your best bet is > to set HISTFILESIZE to some very large value. Actually, what I want is to prevent writing to the history file at all when bash exits. (Not all the time, just in certain cases that other logic in .bashrc will be able to detect. Unsetting HISTFILESIZE unconditionally was a simplified test case.) Should I unset HISTFILE, or set it to /dev/null, instead of trying to mess with HISTFILESIZE?