Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rochester!ritcv!rocksvax!parcvax!hplabs!sdcrdcf!sdcsvax!ncr-sd!greg From: greg@ncr-sd.UUCP (Greg Noel) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Re: C-Shell weirdness (count of words in a variable) Message-ID: <434@ncr-sd.UUCP> Date: Thu, 27-Mar-86 04:48:28 EST Article-I.D.: ncr-sd.434 Posted: Thu Mar 27 04:48:28 1986 Date-Received: Sun, 20-Apr-86 23:59:24 EST References: <676@nbires.UUCP> <2021@hao.UUCP> <678@nbires.UUCP> <2024@hao.UUCP> Reply-To: greg@ncr-sd.UUCP (Greg Noel) Organization: NCR Corporation, San Diego Lines: 19 In article <2024@hao.UUCP> woods@hao.UUCP (Greg Woods) writes: >> > set hosed >> > echo $#hosed >> > THEN you will get 0. >> Sorry, I tried the example that is supposed to yield zero and I got one >> instead. >> The answer is that you can't have a variable with 0 words at all. >> This fact I find counter-intuitive and undocumented > I stand corrected. It seems that $#var is either an error or a positive >integer. Counterintuitive is debatable, however; ..... No, there is a way to get a C shell variable with zero words: set hosed = () Counterintuitive is relative -- this was obvous to me; but then, I wasn't trying to do it, it was an accidential side-effect of doing: set something = (`some command`) if $#something ...... -- -- Greg Noel, NCR Rancho Bernardo Greg@ncr-sd.UUCP or Greg@nosc.ARPA