[net.bugs] csh command substitution brain damage

trb@masscomp.UUCP (07/17/84)

While reloading my ethernet code a few minutes ago, I realized that
the line I needed was in my /etc/rc file, so I typed this to csh:

	% `grep netload /etc/rc`

and csh came back with

	`grep netload /etc/rc`: Ambiguous.

I'm surprised that I'd never tried this idiom before, and also somewhat
surprised that csh would barf on it.

This works on all sh's and barfs on all csh's around here, through
4.2BSD.

I don't have a fix and I'm not inclined to look for one, since many is
the time that csh finds any command which is interesting at all,
ambiguous.  (When I said that I was surprised that csh barfed on it, I
was not telling the whole truth.) And anyway, no real hacker would hack
a shell that wasn't written in ALGOL68.

	Andy Tannenbaum   Masscomp Inc  Westford MA   (617) 692-6200 x274

greg@sdcsvax.UUCP (Greg Noel) (07/19/84)

Tribble trouble again: in article <492@masscomp.UUCP> trb@masscomp.UUCP
writes that:
	% `grep netload /etc/rc`
doesn't work correctly when given to the C shell.  Yep, it's a well-known
bug -- or actually a feature, since it's documented.  My favorite example,
which shows why you might actually want to do this, is:
	% `tset various-options some-terminal`
which should set up the TERM and TERMCAP environment variables.  It's so
obvious that you'd want to do that with tset that the bug is explained and
documented under "tset" -- where else?  It also explains that the working
(does that mean correct?) form is:
	% eval `tset various-options some-terminal`
It also says that the bug will be fixed someday.

If you can't detect the note of sarcasm in the above paragraph, take my
word for it -- it's there.
-- 
-- Greg Noel, NCR Torrey Pines       Greg@sdcsvax.UUCP or Greg@nosc.ARPA

chris@umcp-cs.UUCP (07/21/84)

While I won't argue that it's a ``good thing'', the C shell was
apparently *designed* to give the ``ambiguous'' message.  Any time
globbing produces more than one word for what might be argv[0],
the C shell gives you the ``ambiguous'' message.  So

	% `look metro`
says
	`look metro`: Ambiguous.

but

	% `look metron`
says
	metronome: Command not found.

It makes a certain amount of sense, though I think I'd prefer the
other way.  (Hmm---yet another C shell magic variable?)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland