weird csh thing
Brandon S. Allbery KB8JRR
allbery at NCoast.ORG
Tue Jan 8 12:58:28 AEST 1991
As quoted from <BAGCHI.91Jan6000722 at snarf.eecs.umich.edu> by bagchi at 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 at 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
More information about the Comp.unix.shell
mailing list