more on csh quirks

Larry West west at sdcsla.UUCP
Sat Apr 13 17:33:10 AEST 1985


In article <9845 at brl-tgr.ARPA> argv at ucb-vax.ARPA writes:
>
>set foo = $<
>
>if the user types "foo bar" then 
>
>if($foo == "something") etc..
>
>will die with an "expression syntax" because of the space.  
>I thought, perhaps, that if the shell parsed the "foo" and
>"bar" into two separate tokens, I should be able to access
>$foo[0] and $foo[1] and get "foo" and "bar" respectively.
>This also is not the case. 

All you need to do is:
	set foo = $<
	set foo = ( $foo )
the latter expands the string into separate words.

For comparisions of strings, try:
	if ( "X$foo" == "Xsomething" ) et cetera...

-- 

Larry West			Institute for Cognitive Science
(USA+619-)452-6220		UC San Diego (mailcode C-015) [x6220]
ARPA: <west at nprdc.ARPA>		La Jolla, CA  92093  U.S.A.
UUCP: {ucbvax,sdcrdcf,decvax,ihnp4}!sdcsvax!sdcsla!west OR ulysses!sdcsla!west



More information about the Comp.unix.wizards mailing list