Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix-wizards Subject: Re: More C-shell weirdness [Another word count problem] Message-ID: <690@umcp-cs.UUCP> Date: Thu, 3-Apr-86 21:34:19 EST Article-I.D.: umcp-cs.690 Posted: Thu Apr 3 21:34:19 1986 Date-Received: Sun, 6-Apr-86 01:22:35 EST References: <684@nbires.UUCP> Reply-To: chris@maryland.UUCP (Chris Torek) Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 41 Keywords: quoting In article <684@nbires.UUCP> nose@nbires.UUCP writes: >set a = '' >set a = ($a '') >echo $#a > >Yields 1 > >set a = ('' '') >echo $#a > >Yields 2 It is all a matter of quoting: set a = ''; set a = ("$a" ''); echo $#a gives `2'. Your first example gives `1' because the C shell does history substitution (none), then variable expansion---now the command is set a = ( '') ---then alias expansion (none), and finally executes it. With the double quotes, variable expansion yeilds set a = ("" '') which is of course two words. It is often important to quote variables being expanded. For instance: set a = '*' set a = ($a) echo $a prints the same thing as `echo *'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu