Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Sep 2008 14:42:12 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        manish jain <unxfbsdi@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Incorrect commandline history with bash
Message-ID:  <20080920214212.GA82955@icarus.home.lan>
In-Reply-To: <71a1c60e0809201048s168fe713j3ec661eeb93f4492@mail.gmail.com>
References:  <71a1c60e0809201048s168fe713j3ec661eeb93f4492@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 20, 2008 at 11:18:34PM +0530, manish jain wrote:
> I just migrated from Linux and I am now using FreeBSD 6.3. My keyboard
> layout is US-ISO and my TERM is con25. I am using bash#3 as my login shell.
> (I installed the bash package from the distribution media, not from
> /usr/ports).
> 
> The problem is that bash does not remember my commands correctly. Almost all
> commands I enter in a login session are forgotten in the next session. Using
> the Up and Down arrow keys navigates a mangled and incomlete command
> history. Even using Ctrl-r for a reverse find almost never fetches a command
> I had actually typed in previously.
> 
> The following are the contents of my .bash_profile and .bashrc:
> 
> #.bash_profile :
> [ -f ~/.bashrc ] && source ~/.bashrc
> #end-of-file

You have this backwards.  ~/.bashrc should contain something like this:

if [ -f "${HOME}/.bash_profile" ]
then
  source "${HOME}/.bash_profile"
fi

And all of your applicable environment settings should go in
.bash_profile.  This probably won't solve your problem, but I thought
I'd point it out.

> #.bashrc :
> export HISTFILESIZE=200
> shopt -s cmdhist
> shopt -s histappend
> #end-of-file

I set none of these things (though I do use export HISTTIMEFORMAT="%T  "
but that should not affect your problem) and my .bash_history always
contains commands from past sessions, including timestamps too.

My options are defaults:

$ shopt | egrep 'cmdhist|histappend'
cmdhist         on
histappend      off

Can you please try pkg_delete'ing the bash you installed from the
installation media, and instead update your ports tree via csup (not
cvsup) and then build/install bash from /usr/ports/shells/bash?

Finally, please do not cross-post to multiple lists.  It's shunned upon,
and generally pointless as not everyone is subscribed to both lists.
I've removed freebsd-questions@freebsd.org, as this could be a ports
issue rather than a generic question.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080920214212.GA82955>