delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/23/12:28:45

X-Spam-Check-By: sourceware.org
Date: Tue, 23 May 2006 12:27:45 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: bob <robert DOT lambert AT ae DOT ge DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: export arrays in cygwin ksh
In-Reply-To: <loom.20060523T162715-39@post.gmane.org>
Message-ID: <Pine.GSO.4.63.0605231215051.8977@access1.cims.nyu.edu>
References: <loom DOT 20060523T162715-39 AT post DOT gmane DOT org>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019