Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: csh weirdness (HELP!) Message-ID: <26082@mimsy.umd.edu> Date: 19 Aug 90 23:27:11 GMT References: <1990Aug13.151415.14575@elroy.jpl.nasa.gov> <8000007@hpopd.HP.COM> <1990Aug19.011139.13718@watcgl.waterloo.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 76 In article <1990Aug19.011139.13718@watcgl.waterloo.edu> idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) writes: >Someone is claming that CSH's "Ambiguous" error is due to different >handling of the built-in kill vs. /bin/kill. (You must mean me here.) >I think not: > > % `echo date` > Sat Aug 18 20:10:09 EDT 1990 > % `echo date foo` > `echo date foo`: Ambiguous. Ah, but this is a symptom of the same thing. >CSH is just stupid about the number of words that are allowed to >expand in a command name generated by back-quotes. This is true; but in kill `echo 1 2` there is exactly one word in the command name. If you try echo `echo 1 2` (for instance) you get 1 2 so it is obvious that >It only allows one word, because it won't re-parse the line for >arguments only under some circumstances (specifically, all those that call the routine `globone' with one of the `words' from the `lexer'). The built-in kill routine (dokill()) is one such place. The routine that runs ordinary (not built in) commands, however, calls globone only for av[0], the command name; it calls tglob and glob on the rest of av. If dokill called tglob and glob in the same way, before marching down the argument list looking for `%'s, the built-in kill would work properly. >same error here: > > % date >`echo hi hi` > `echo hi hi`: Ambiguous. Again, csh calls globone() for an av[] element following a redirection. >CSH expects single words in funny places, and that's the error you get >if you don't comply. In this case, it is probably a good thing: if you typed date > xy* you probably meant to put the output in the (existing) file `xyzzy', not into `xylophone' (which you forgot about) with the argument `xyzzy' passed on to `date'. (After all, you would not want to clobber the file with the information you saved about ordering xylophones. That xylophone is IMPORTANT! :-) ) >For more entertainment, a huge list of CSH bugs (4.2BSD, but most >still apply) is available via anonymous ftp from watcgl.waterloo.edu >as CSHbugs.Z (compressed). Given the csh souce, no doubt it *has* to be kept compressed. :-) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris (New campus phone system, active sometime soon: +1 301 405 2750)