C-Shell weirdness
jdz at wucec2.UUCP
jdz at wucec2.UUCP
Wed Apr 2 04:57:14 AEST 1986
In article <2365 at teddy.UUCP> jpn at teddy.UUCP (John P. Nelson) writes:
>Uh, all csh variables (except argv) will always have ONE element unless you
>used the set notation when setting their value. The way to create a variable
>with zero elements is:
>
>set hosed = ()
Not quite. If you use execution quotes (i.e. `foo`) you can get variables
with zero elements. I have a shell script which returns a list of users doing
slightly anti-social things on our network of student machines; I do this:
set abusers=`anti-social_stuff`; if ($#abusers) flog $abusers ; unset abusers
Which flogs anyti-social abusers, if any. If the shell script returns nothing
(i.e. send nothing to its stdout) then abusers has zero elements. Which is how
one would hope it would behave.
--
Jason D. Zions ...!{seismo,cbosgd,ihnp4}!wucs!wucec2!jdz
Washington University Center for Engineering Computing
Box 1045
St. Louis MO 63130 USA (314) 889-5097
No need to disclaim - they know I'm doing this!
More information about the Comp.unix.wizards
mailing list