[Repost] Re: csh - now how about pseudo-arrays?
Maarten Litmaath
maart at cs.vu.nl
Sat Apr 1 02:37:39 AEST 1989
pklammer at 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 at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list