awk/csh parsing error?

Hans Mulder hansm at cs.kun.nl
Thu Jan 17 00:52:18 AEST 1991


In article <1991Jan15.154832.1804 at netnews.whoi.edu> rich at boreas.whoi.edu writes:
>I seem to have run across a rather strange bug (feature?) while using
>awk(1) and csh(1) on a Sparcstation with SunOS 4.1.

Close, but no cigar.  You ran across one of the many bugs in csh(1);
awk(1) has nothing to do with it.  The man page for csh(1) mentions
(under BUGS): "Although robust enough for general use, adventures into
the esoteric periphery of the C shell may reveal unexpected quirks."

This "esoteric periphery" is rather large and the quirks are many.

In this case, the problem is that if a command begins with a `...`,
your frienly C shell decides that this `...` must produce exactly one
word, the command name, and not any arguments.  For example:

example%  `echo ls`
bar  foo
example%  ls `echo foo bar`
bar  foo
example%  `echo ls foo bar`
`echo ls foo bar`: Ambiguous.

If you want to do complicated things, use the Bourne shell or a
derivative (Korn shell, Bourne Again SHell, whatever..)

example$  `echo ls`
bar  foo
example$  ls `echo foo bar`
bar  foo
example$  `echo ls foo bar`
bar  foo


Have a nice day,

Hans Mulder	hansm at cs.kun.nl



More information about the Comp.unix.shell mailing list