I was customizing my bash prompt (I'm on OS X 10.7) when I came across something strange. Within my prompt I included !, which should give me the history number.However the history number always starts out at 501, instead of 1. This is true even if I restart Terminal.I can't seem to find anything close to this, I was wondering if you guys could offer some insight.
Bash history number not starting at 1?
bash;terminal;command history;prompt
From man bash:   On startup, the history is initialized from the file named by the vari   able HISTFILE (default ~/.bash_history).  The file named by  the  value   of  HISTFILE  is  truncated,  if necessary, to contain no more than the   number of lines specified by the value of HISTFILESIZE. [...] When an    interactive  shell  exits, the last $HISTSIZE lines are copied from the   history list to $HISTFILE.While that text is quite clear, let's play a bit by example (this is a deb system, but bash is bash).My history status right now:~$ set | grep HISTHISTCONTROL=ignoredups:ignorespaceHISTFILE=/home/hmontoliu/.bash_historyHISTFILESIZE=2000HISTSIZE=1000Since HISTFILESIZE is 2000 and HISTSIZE is 1000 only the last 1000 lines of the HISTFILE are available so you can get the wrong impression that my history starts at 1000.~$ history | head -1 1000  if i=1; then echo $i; done~$ history | wc -l1000But indeed the HISTFILE stores the last 2000 commands: ~$ wc -l $HISTFILE2000 /home/hmontoliu/.bash_historyIf you think that it is annoying you can equal the HISTSIZE and HISTFILESIZE~$ echo export HISTSIZE=$HISTFILESIZE >> .bashrc~$ bash -l~$ history | head -1    1  ls~$ history | wc -l2000~$ set | grep HISTHISTCONTROL=ignoredups:ignorespaceHISTFILE=/home/hmontoliu/.bash_historyHISTFILESIZE=2000HISTSIZE=2000A final hint: you should run help history to view the actions you can do with your history