Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ncoast.UUCP Path: utzoo!linus!decvax!cwruecmp!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: csh variables Message-ID: <1086@ncoast.UUCP> Date: Mon, 31-Mar-86 19:43:08 EST Article-I.D.: ncoast.1086 Posted: Mon Mar 31 19:43:08 1986 Date-Received: Wed, 2-Apr-86 07:42:06 EST References: <676@nbires.UUCP> <2021@hao.UUCP> <678@nbires.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: net.unix-wizards Distribution: net Organization: North Coast Computer Resources Lines: 40 Xref: linus net.unix-wizards:14491 net.bugs.4bsd:1713 Expires: Quoted from <678@nbires.UUCP> ["Re: C-Shell weirdness (count of words in a variable)"], by nose@nbires.UUCP (Steve Dunn)... +--------------- | > | > > 2: Count of number of words in a variable (Or when is nothing something) | > > | > > This: | > > | > > set hosed = '' | > > echo $#hosed | > > | > > yields the result '1' | > | > But of course! The variable has one value: a null string. And, if you do | > | > set hosed=( '' junk) | > | > then what do you suppose $#hosed is? If you got 2, drink a potion of raise | > level and read on! :-) If you do +--------------- I had a flash of insight one day after trying unsuccessfully to figure this out; think of it not as Bourne shell variables, but as an obscure dialect of LISP. If '' is T and () is NIL then the behavior of set foo versus set foo = () is reasonable. It also explains the word business reasonably. (I'm thinking specifically of a very limited LISP I ran into once; I don't remember which one, but it had never heard of dotted pairs Maybe it was based on csh :-) --Brandon -- decvax!cwruecmp!ncoast!allbery ncoast!allbery@Case.CSNET ncoast!tdi2!brandon (ncoast!tdi2!root for business) 6615 Center St. #A1-105, Mentor, OH 44060-4101 Phone: +01 216 974 9210 CIS 74106,1032 MCI MAIL BALLBERY (part-time) ``You're being logical -- a most unfair way to argue!''