Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: [Repost] Re: csh - now how about pseudo-arrays? Keywords: Bill `Bugs Bunny' Joy Message-ID: <2232@solo11.cs.vu.nl> Date: 31 Mar 89 16:37:39 GMT References: <2134@pikes.Colorado.EDU> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 39 pklammer@pikes.Colorado.EDU (Peter Klammer) writes: \... \#csh \ \@ n = 0 \@ n += 1; set entry$n = (EXIT EXIT) @ n++; set ... \@ n += 1; set entry$n = (ADDUSER ADD a new user account) \@ n += 1; set entry$n = (MODUSER MODIFY a user account) \... \#This, for specific case 3, works: \ set command = $entry3[1] \ set prompt = "${entry3[2-]}" Huh? I got `Variable syntax.' on the second assignment! Of course the above SHOULD work. The `3' ending the name of the variable seems to cause the trouble, because the following DOES work: set prompt = "${argv[2-]}" A workaround for our problem is: set prompt = "$entry3[2-]" # forget the braces \#This, for general case i, fails, with message 'Variable Syntax': \@ i = 1 \while( $i <= $n ) \ set command = ${entry$i[1]} \ set prompt = "${entry$i[2-]}" eval set command = '"$entry'$i'[1]"' eval set prompt = '"$entry'$i'[2-]"' -- Modeless editors and strong typing: |Maarten Litmaath @ VU Amsterdam: both for people with weak memories. |maart@cs.vu.nl, mcvax!botter!maart