Re: Switching from tcsh to bash as an interactive shell

From: P.T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: 09/20/04


Date: Sun, 19 Sep 2004 23:03:50 GMT

Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
> On 2004-09-19, P.T. Breuer wrote:
> > P.T. Breuer <ptb@oboe.it.uc3m.es> wrote:
> >> And I keep forgetting to mention, uh, what I keep forgetting.
> >
> > Oh yes. I keep forgetting to mention that all these people who witter
> > on about their marvellous history in bash, LOSE their history as soon
> > as they log out of a bash shell that doesn't share the same history.
> >
> > I.e. don't open two bash shells at once, folks.

> B.S.!!

I beg your pardon? Is your name Barney Scrotus?

> I usually have 3 or 4 open on my desktop machine; I don't lose
> anything.

The last you close will determine which "latest" history you record.
Let's expand ..

Are you perhaps suggesting that the shell append to it throughout
instead of only at shell termination? Tough - the previous or parallel
shells also had the file open for writing, and your commands will be all
mixed up inside if they are all writing at the end all the time. So the
order will be wrong.

Hyacc.

> > (or two tcsh shells, since the same thing will happen in tcsh ...)

> It's probably as easy to avoid losing it in tcsh as it is in
> bash. (Or maybe it isn't, and that's another reason for not using
> tcsh.)

It's impossible, due to natural laws, causality, etc. etc. You are
trying to write a linear sequence of commands. However, the real trace
of your commands is a forking tree. As soon as you launch another
shell, the trace forks. Then you have the problem of choosing HOW th
etree should be linearized.

OK - so what do you choose? The longest trace? That loses the rest. How
about interleaving the traces in some way? Well, that will wreck
command order. How about interleaving segmentwise (maintain order
imbetween branch points)? Tough, but the segments get interleaved.

And then which commands fall off the start of the history file first? Why
not set your history length to "5" and make a quick test. You'll find
the last shell to close has the commands retained, nothing else does.

Peter



Relevant Pages

  • Re: Switching from tcsh to bash as an interactive shell
    ... >> on about their marvellous history in bash, ... >> as they log out of a bash shell that doesn't share the same history. ... trying to write a linear sequence of commands. ... However, the real trace ...
    (comp.os.linux.misc)
  • linux shell TAB completion and history listing tweaks needed
    ... I've two shell ideas I wanted to implement and needed some advice on ... arrow recall history. ... All Linux commands come with myriad useful options but usually I ... I mean the man page usually lists all options but not in a ...
    (comp.os.linux.misc)
  • Re: history for other users and appending pwd to history
    ... you will see the last 100 commands saved to ... shell, there's basically no way for another process to get to it (unless ... (thus writing out the history). ... There is also a slight problem if the student is running multiple ...
    (comp.os.linux.misc)
  • Re: how can I write shell history immediately to HISTFILE
    ... The bash internal command "history" can be told to append ... to the history file, any new commands. ... This will append every new command to the history file, ... When you say `more than one shell at a time'.. ...
    (comp.unix.shell)
  • bash history customizing
    ... I really like my bash history facility, so much so that i have about ... I would like to prevent invalid commands from being ... cp somefile anotherfile ...
    (comp.unix.misc)