Path: utzoo!attcan!sobeco!onfcanim!zap!matrox!IRO.UMontreal.CA!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bu.edu!att!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.shell Subject: Re: weird csh thing Message-ID: <1991Jan8.015828.25320@NCoast.ORG> Date: 8 Jan 91 01:58:28 GMT References: Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.shell Organization: North Coast Computer Resources (ncoast) Lines: 30 As quoted from by bagchi@eecs.umich.edu (Ranjan Bagchi): +--------------- | anyone care to explain?? (I`m in csh) | $ echo $p | w | tail +3 | $ $p | Usage: w [ -hlsuw ] [ user ] | $ w | tail +3 | benjo ttyp3 10:13pm 41 4 -sh | benjo ttyp4 10:17pm 3:22 4 -csh +--------------- You'll find that sh does the same thing. The reason is that variables are handled *after* the line is broken into commands. Since | is a command separator, it is parsed relatively early. After sh or csh does command parsing, it expands variables... and since it's too late to handle |, it's passed literally. Similarly, < > is (I think) parsed *but not necessarily executed* before variable substitution. I also seem to remember redirecting into the output of a command working under sh but not under csh.... Shells are *weird* beasties. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY