On Sun, Dec 04, 2005 at 12:11:45PM -0700, Trenton Adams wrote
> There's one thing that has kind of been a little annoying since
> I started using gentoo a few months ago. That's the fact that
> when you open multiple bash logins, only the history of the last
> one logged out actually gets saved. Now I know that redhat saves
> all of them. Does anyone know how it does this? Is it a patch,
> a certain scripts, what?
>
> Anyhow, I think gentoo really needs this feature. It's a little
> annoying to lose all of your history when you've been working in
> multiple windows.
I read your post, and slapped together the following, which goes into
~/.bashrc. Warning... some backtick expansion included here. Is there
a simpler way to find out which tty or pts you're running in?
# If running interactively, then:
if [ "$PS1" ]; then
# Set up a separate HISTFILE, depending on which tty we logged in
# from. Convert slashes in tty names (e.g. "pts/0") into underscores.
mytty=`ps -ef | grep ${USER} | tail -n 1 | sed "s/^.\{30\}//
s/ .*$//
sx/x_x"`
export HISTFILE="${HOME}/.history_${mytty}"
The command figures out which tty/pts we're launched in, and sets a
history file containing the session name. One booby-trap is forward
slashes, which aren't legal as filenames (they're interpreted as
directories).
--
Walter Dnes <[EMAIL PROTECTED]> In linux /sbin/init is Job #1
My musings on technology and security at http://tech_sec.blog.ca
--
[email protected] mailing list