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