sena@infinet.UUCP (Fred Sena) (01/16/91)
(I would have emailed this, but I don't understand how to mail to internet addresses using bang paths. Could someone tell me how?) In article <1991Jan15.154832.1804@netnews.whoi.edu> rich@boreas.whoi.edu writes: > >rich(2)% `awk ' /\.LP/ {printf "aabb" }' <test` >aabb: Command not found. [...] >In the second case, adding a space to the first printf string ("aa ") causes >a parsing error. Finally, if we repeat all of the the above cases prefixing >the commands with echo(1V), awk works perfectly every time: > >rich(8)% echo `awk ' /\.LP/ {printf "aabb" }' <test` >aabb > > >Any ideas? In the first case, the C-shell is attempting to execute the output of your awk command. It's as if you typed 'aabb' at the csh prompt, which of course is not a valid command. In the second case, you are passing the output of the 'awk' command as an argument to the 'echo' command, which is OK. --fred -- -------------------------------------------------- Frederick J. Sena sena@infinet.UUCP Memotec Datacom, Inc. N. Andover, MA
hansm@cs.kun.nl (Hans Mulder) (01/16/91)
In article <1991Jan15.154832.1804@netnews.whoi.edu> rich@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@cs.kun.nl