ugh.book

(singke) #1

152 csh, pipes, and find


Date: Mon, 7 May 90 18:00:27 -0700
From: Andy Beals <[email protected]>
Subject: Re: today’s gripe: fg %3
To: UNIX-HATERS

Not only can you say %emacs or even %e to restart a job [if it’s a
unique completion], one can also say %?foo if the substring “foo”
appeared in the command line.

Of course, !ema and !?foo also work for history substitution.

However, the pinheads at UCB didn’t make !?foo recognize subse-
quent editing commands so the brain-damaged c-shell won’t recog-
nize things like

!?foo:s/foo/bar&/:p

making typing a pain.

Was it really so hard to scan forward for that one editing character?

All of this gets a little confusing, even for Unix “experts.” Take the case of
Milt Epstein, who wanted a way of writing a shell script to determine the
exact command line being typed, without any preprocessing by the shell.
He found out that this wasn’t easy because the shell does so much on the
program’s “behalf.” To avoid shell processing required an amazingly
arcane incantation that not even most experts can understand. This is typi-
cal of Unix, making apparently simple things incredibly difficult to do,
simply because they weren’t thought of when Unix was first built:
Date: 19 Aug 91 15:26:00 GMT
From: [email protected]
Subject: ${1+“$@”} in /bin/sh family of shells shell scripts
Newsgroups: comp.emacs,gnu.emacs.help,comp.unix.shell

>>>>> On Sun, 18 Aug 91 18:21:58 -0500,
>>>>> Milt Epstein <[email protected]> said:

Milt> what does the “${1+“$@”}” mean? I’m sure it’s to
Milt> read in the rest of the command line arguments, but
Milt> I’m not sure exactly what it means.

It’s the way to exactly reproduce the command line arguments in the
/bin/sh family of shells shell script.
Free download pdf