Getting the shell to cooperate (was Re: [Pdx-pm] solved: job control (still got a question))

Tom Phoenix rootbeer at redcat.com
Tue Jun 3 19:17:47 CDT 2003


On Tue, 3 Jun 2003, Randall Hansen wrote:

> Tom Phoenix suggested the pipe in one of the early replies and it's a
> nice solution -- and end-run around the problem.

Actually, more than an end-run, I think that this sort of thing is the
only solution.  (That is, unless you do some really freaky and REALLY
non-portable stuff.) If you need to know what only the shell knows, get
the shell to tell you. If you want to do what only the shell can do, get
the shell to do it.

This sort of thing is also what I tell students who want to write their
own replacement cd command. They say, "I want to make my own cd command,
but it should report the name of the old directory every time I use it."
You can do that, but only with the shell's cooperation. (That's because
you can't change the shell's current working directory without the shell's
help.)

If anybody posts a way to do this sort of thing without the shell's
cooperation, I'll leave it to the list's other members to point out what's
wrong. :-)

--Tom Phoenix




More information about the Pdx-pm-list mailing list