Subject: RE: shell script
To: None <kmayson@viconet.com>
From: Ken Nakata <kenn@synap.ne.jp>
List: port-mac68k
Date: 03/04/2000 01:37:54
On Fri, 3 Mar 2000 11:24:29 -0500, "Kadari Mayson" <kmayson@viconet.com> wrote:
> Re-direct to where?  You could redirect it to a file like date >& date.txt.
> Pipes are not always used for re-directs.

Pipe can be considered another form of redirect, since it redirects
the standard output to something other than the control tty.  But
that's not what he was asking.

> >     Excuse me , I know it's not mac68k specific question... I just want
> > to know if  it's possible to redirect the output of a command in a
> > variable in a csh script ? I read all the csh man page and I'm still
> > stuck...
> >
> > date | awk {'print 1$'} |   ???? to put it in a variable .

Use sh instead of csh.  In sh, you can do it as easily as:

date | awk '{print $1}' | read dow

Though you can achieve the same effect in csh, albeit in a very
awkward way, like:

setenv dow `date | awk '{print $1}'`

The first form is safer than the second form, since the first form is
not affected by the length of output whereas the second form is.  Oh
BTW, that is why we have xargs.

Csh's fine as an interactive command shell, but it sucks a** as a
scripting language.

Ken