This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: export arrays in cygwin ksh


On Tue, 23 May 2006, bob wrote:

> Help
>
> Trying to use ksh and export arrays in cygwin.  It works on my unix
> workstation but not on PC cygwin.  Any help would be appreciated.
> Tried to post earlier and it did not make it apparently.
>
> Thanks
> Bob
>
> #!/bin/ksh
> echo "in test1"
> vname[1]="Dog"
> vname[2]="Cat"
> for i in 1 2
> do
>    echo "vname[$i]=${vname[$i]}"
> done
> export vname[*]
> test2
>
> #!/bin/ksh
> echo "in test2"
> for i in 1 2
> do
>    echo "vname[$i]=${vname[$i]}"
> done
>
> Output:
> test1
> in test1
> vname[1]=Dog
> vname[2]=Cat
> ./test1: line 8: export: `vname[*]': not a valid identifier
> in test2
> vname[1]=
> vname[2]=

Two comments.

One: the output above didn't come from PDKsh in Cygwin (and, most likely,
didn't even come from the script you posted, since the export statement is
on line 9 in your script).  FYI, there is more than one ksh implementation
in Cygwin, and you'll need to tell us more about your Cygwin installation
(by following the Cygwin problem reporting guidelines at
<http://cygwin.com/problems.html>, especially the bit on *attaching* the
output of "cygcheck -svr").

Two: PDKsh doesn't understand the "export a[*]" syntax.  It does
understand the "export a[1]" syntax, and even adds the array elements to
the export table, but there *is* a bug in it that doesn't actually
propagate the exported array elements to subshells.  I'll look into it
once I find the time.

Igor Peshansky, volunteer PDKsh maintainer for Cygwin
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]