Thread View: net.bugs
5 messages
5 total messages
Started by trb
Tue, 17 Jul 1984 16:23
csh command substitution brain damage
Author: trb
Date: Tue, 17 Jul 1984 16:23
Date: Tue, 17 Jul 1984 16:23
22 lines
1296 bytes
1296 bytes
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
CSH `...` command substitution brain damage; not really?
Author: idallen
Date: Wed, 18 Jul 1984 15:27
Date: Wed, 18 Jul 1984 15:27
32 lines
1484 bytes
1484 bytes
The first thing on a command line is expected to be a command word to CSH.
It is the same sort of word as:
echo hi >`expression`
CSH expects this word not to contain blanks; you can successfully say:
`echo date`
but not:
`echo echo hi`
This may be correct, since one wonders what:
`expression` arg1 arg2 arg3 arg4
should do. If <expression> expanded to multiple words, the supposed
args would not be the first ones passed to the command, just as:
echo hi >`expression`
would not do what you expect if <expression> expanded to multiple
words, only the first of which was taken as the file name for redirection.
It's a case of the shell being conservative about peculiar constructions.
If you tell CSH to re-parse the stuff coming in from `...`, imbedded
blanks expand and your example works:
eval `grep bleen /etc/rc`
--
-IAN! (Ian! D. Allen) University of Waterloo
Re: csh command substitution brain damage
Author: Greg Noel
Date: Thu, 19 Jul 1984 08:22
Date: Thu, 19 Jul 1984 08:22
18 lines
1560 bytes
1560 bytes
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
Re: csh command substitution brain damage
Author: chris
Date: Sat, 21 Jul 1984 00:43
Date: Sat, 21 Jul 1984 00:43
21 lines
1280 bytes
1280 bytes
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
Re: csh command substitution brain damag - (nf)
Author: pedz
Date: Sat, 21 Jul 1984 23:04
Date: Sat, 21 Jul 1984 23:04
13 lines
1024 bytes
1024 bytes
#R:masscomp:-49200:smu:21700001:000:351 smu!pedz Jul 21 18:04:00 1984 RE:Brain Damaged csh command parsing We came accross this problem only a few days ago. We were tring to get the tset -s option to work. The secret is to stick an eval infront. Rather or not this is how things should be done or how it was intended to be done, I am not going to speculate. Perry Smith convex!smu!pedz (uucp) pedz@smu (CS-Net)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads