> > I hate to, um, bash Bourne shell compatibility, but this does seem a
> > silly and indirect way to get at the last argument. Two shells which
> > make this easier are rc and es, where the notation $*($#*) does the job.
>
> I hate to, um, bash es and rc, but when will either of these shells
> have job control? Pretty good shells, otherwise.
Probably never. I can't speak about rc, but we have said that if
someone can come up with a small number of primitives to add to es which
will enable people to write job control as a user-level extension, we'd
be happy to add them.
On the other hand, job control is a hard thing to fit into es, where
shell functions are extremely pervasive; no shells that I know of
handle ^Z (SIGSTOP) correctly if it comes in while a complex command or
shell function is running.
To give an idea of what I mean, let's take a simple example:
touch foo; sleep 100; rm foo
Run this in a job controlling shell. Type Control-Z (or whatever
character you use) during the sleep. What happens?
I've seen three answers, depending on which shell you use:
(a) The control-z is ignored.
(b) The sleep is stopped, and if it is continued (fore- or
background), the ``rm foo'' is ignored.
(c) The sleep is stopped and the rm happens right away.
I've found no existing shell which does:
(d) The sleep is stopped, and when it is continued, the rm
is executed.
To my thinking, (d) is the only correct answer. I'm pretty sure
the reason that most shells don't do it is that it's really hard to
implement correctly, not that anyone thinks that (a), (b), or (c)
is the right answer. (My understanding of the state of the art may
be outdated; please correct me if I'm wrong and some shell does do
the right thing.)
[snip]
I would say that (c) is the right behavior. If you want the whole
command to be treated as one job, you should write
(touch foo; sleep 100; rm foo)
in order for the shell to put in in a subshell and run it. (At least
bash works this way, and if I'm not completely off, so does (t)csh)
If you don't do it this way, redirecting of stdin/stdout/stderr would
become difficult. For example, how would you interpretate a command
like this?
echo foo; echo bar > myfile
Should myfile contain both foo and bar (the result of the whole
command), or should it only contain bar? (I know, this example
probably would win the `stupidest example award' if there was one,
but it's early in the morning and I haven't had my cup of morning
coffee yet, so....:)
/Stenis
--
**********************************************************************
* Newport Beach CA 92663 * Tel : +1 714 675 4783 (home) *
* USA * +1 714 824 5086 (Office) *
* * Fax : +1 714 824 4056 *
**********************************************************************
There are very few personal problems that cannot be solved through a
suitable application of high explosives.
**********************************************************************