On Wed, Dec 07, 2005 at 05:28:09PM -0500, Walter Dnes wrote: > On Mon, Dec 05, 2005 at 03:26:12AM -0500, Willie Wong wrote > > > from 'man tty' > > > > tty - print the file name of the terminal connected to standard input > > Thanks. That simplifies things a bit, but it also prefixes with > "/dev/", so the revised script goes like so... > > # 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=`tty | sed "s/\/dev\/// > sx/x_xg"` > export HISTFILE="${HOME}/.history_${mytty}" >
Personally, I would've gone with creating a directory ~/.history-bash and use export HISTFILE="${HOME}/.history-bash/`tty | cut -c 6-`" it will help tidy up somewhat the root of your home directory. It would also make history searching a tad confusing... AFAIK, Bash loads the history on startup from HISTFILE. So... suppose you issued a long command in pts4. You then closed all the ptses. Then you start up another one. Well, it happens to be pts1... then even ctrl-r will not help you find the really long command you typed in pts4. W -- "`Er, hey Earthman...' `Arthur,' said Arthur. `Yeah, could you just sort of keep this robot with you and guard this end of the passageway. OK?' `Guard?' said Arthur. `What from? You just said there's no one here.' `Yeah, well, just for safety, OK?' said Zaphod. `Whose? Yours or mine?'" - Arthur drawing the short straw on Magrathea. Sortir en Pantoufles: up 25 days, 16:08 -- gentoo-user@gentoo.org mailing list