Re: export arrays from cygwin ksh
* mwoehlke (2006-05-23 16:37 +) It does seem like this doesn't work - at least, not how I would expect it to - on bash (either on Cygwin or on Linux). Maybe you should try ksh on Cygwin. He said he did. Read the subject of this thread. -- 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/
Re: export arrays from cygwin ksh
Thorsten Kampe wrote: * mwoehlke (2006-05-23 16:37 +) It does seem like this doesn't work - at least, not how I would expect it to - on bash (either on Cygwin or on Linux). Maybe you should try ksh on Cygwin. He said he did. Read the subject of this thread. Sorry, my apologies... (Maybe he should try the *right* ksh? ;-) ...as per the second instance of this thread.) -- Matthew Doom doom dooM doo-DooM dOOm DOom doOM... DOOM! -- Gir -- 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/
RE: export arrays from cygwin ksh
On 24 May 2006 09:24, Thorsten Kampe wrote: * mwoehlke (2006-05-23 16:37 +) It does seem like this doesn't work - at least, not how I would expect it to - on bash (either on Cygwin or on Linux). Maybe you should try ksh on Cygwin. He said he did. Read the subject of this thread. Yes, but it turned out to be a misnamed copy of bash. Read the *content* of this thread! cheers, DaveK -- Can't think of a witty .sigline today -- 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/
export arrays from cygwin ksh
Hi I have an hp unix script that runs in ksh and am porting it to PC. It uses and exports arrays in hp unix. Does not seem to work in cygwin. Can anybody offer suggestions to accomodate? I tried to put an example below, but I was labeled a top poster and it would not let me do it. Thanks Bob -- 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/
export arrays in cygwin ksh
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]= -- 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/
Re: export arrays from cygwin ksh
* bob (2006-05-23 12:37 +) I have an hp unix script that runs in ksh and am porting it to PC. You mean you have a ksh script that runs on HP Unix? It uses and exports arrays in hp unix. Does not seem to work in cygwin. does not seem to work in Cygwin... To quote an immortal phrase: can you be less specific? Can anybody offer suggestions to accomodate? I tried to put an example below, but I was labeled a top poster and it would not let me do it. Well, top-posting is evil, that's right, but who called you evil and who is it who wouldn't let you do evil? -- 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/
Re: export arrays from cygwin ksh
bob wrote: I have an hp unix script that runs in ksh and am porting it to PC. It uses and exports arrays in hp unix. Does not seem to work in cygwin. Can anybody offer suggestions to accomodate? I tried to put an example below, but I was labeled a top poster and it would not let me do it. Eh? I've never had a message bounce (is there actually something that tries to bounce http://cygwin.com/acronyms/#TOFU? ...must not work very well.) Did you try submitting your example as an attachment? Back to the question: by exports arrays you mean it needs to export an array so that it is inherited by sub-shells? Also, what shell are you using on Cygwin? It does seem like this doesn't work - at least, not how I would expect it to - on bash (either on Cygwin or on Linux). Maybe you should try ksh on Cygwin. -- Matthew Interix, Sphinterix. Cygwin apps don't crash. :-) -- 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/
Re: export arrays from cygwin ksh
mwoehlke wrote: bob wrote: I have an hp unix script that runs in ksh and am porting it to PC. It uses and exports arrays in hp unix. Does not seem to work in cygwin. Can anybody offer suggestions to accomodate? I tried to put an example below, but I was labeled a top poster and it would not let me do it. It does seem like this doesn't work - at least, not how I would expect it to - on bash (either on Cygwin or on Linux). Oh, ok, it doesn't work in bash: GNU Bash-3.0 ... BUGS ... Array variables may not (yet) be exported. (Hmm... bugs: it's too big and slow?) -- Matthew Interix, Sphinterix. Cygwin apps don't crash. :-) -- 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/
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/ |\ _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED] 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/
Re: export arrays in cygwin ksh
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 Igor Thanks much for responding. My responses to your comments: Your right on the output... I cut out the stuff I tried but did not work in the program for clarity. And 2 your are also right that it did not come from PDKsh I actually tried to envoke PDKsh by putting #!/bin/PDKsh on line 1 of test1 and test2 but all I got was an error msg (: bad interpreter: No such file or directory). I have come to realize that there is more than 1 implementation of ksh. The syntax I used in my example is exactly what I use on my hp unix workstation and it works fine on the hp. I did try to export individual elements like you suggest with no luck. I did find in my installation in the cygwin/bin dir a file ksh.exe which is what I assume it was running. Guess that is not pdksh. My own IT people do not know what version of cygwin I am using (I am not laughing!) I will try to find out more info on this. I think we are using redhat, but will dig deeper. Thanks Your last comment - are you saying I may not be able to export my array data to later processes or script files ? Thanks Bob -- 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/
Re: export arrays in cygwin ksh
On Tue, 23 May 2006, bob wrote: 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 Igor Thanks much for responding. My responses to your comments: Your right on the output... I cut out the stuff I tried but did not work in the program for clarity. Would be nice to have the complete testcase, including the output... Not that the export a[*] syntax would work in it in any case... And 2 your are also right that it did not come from PDKsh I actually tried to envoke PDKsh by putting #!/bin/PDKsh on line 1 of test1 and test2 but all I got was an error msg (: bad interpreter: No such file or directory). The filenames may be case sensitive, too -- the executable is called pdksh.exe, not PDKsh.exe. However, if you had followed the Cygwin problem reporting guidelines at http://cygwin.com/problems.html, we would have known what packages you have installed on your system. I have come to realize that there is more than 1 implementation of ksh. The syntax I used in my example is exactly what I use on my hp unix workstation and it works fine on the hp. I did try to export individual elements like you suggest with no luck. What does ksh -c 'echo $KSH_VERSION' print on your hpux workstation? How about on Cygwin? What is the output of ls -l /bin/ksh.exe? I did find in my installation in the cygwin/bin dir a file ksh.exe which is what I assume it was running. Guess that is not pdksh. PDKsh installs a /bin/ksh symlink if none is present. So it could be pdksh. Please follow the above directions so that we can find out. My own IT people do not know what version of cygwin I am using (I am not laughing!) I will try to find out more info on this. I think we are using redhat, but will dig deeper. Thanks Please read and follow the Cygwin problem reporting guidelines at http://cygwin.com/problems.html. That will tell us the version of Cygwin and various packages in your installation. Your last comment - are you saying I may not be able to export my array data to later processes or script files ? You may try the other ksh packages in Cygwin, and see if they address your problem. Otherwise, the portable solution would be something like # In the parent script for i_ in `seq 0 ${#vname[*]}`; do vname_=$vname_ '${vname[$i_]}'; done # In the child script eval set -A vname $vname_ A variant of this solution will also allow exporting arrays in bash. HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED] 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/
Re: export arrays in cygwin ksh
The filenames may be case sensitive, too -- the executable is called pdksh.exe, not PDKsh.exe. However, if you had followed the Cygwin problem reporting guidelines at http://cygwin.com/problems.html, we would have known what packages you have installed on your system. I tried changing case but to no avail. there is no pdksh file in my cygwin/bin directory so I think I am out of luck w/ pdksh. I ran cygcheck as suggested in the url above. Lots of good info. not sure how to attach the file, but here is a partial listing (hopefully I captured what you are looking for!) Cygwin Win95/NT Configuration Diagnostics Current System Time: Tue May 23 14:42:20 2006 Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4 ... HKEY_CURRENT_USER\Software\Cygnus Solutions HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin (default) = `' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2 (default) = 0x002a cygdrive prefix = `/cygdrive' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/ (default) = 0x000a native = `C:\Apps\cygwin' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/afs (default) = `Y:' flags = 0x000a HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/annex (default) = `D:\annex' flags = 0x000a HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/apps (default) = `C:\apps' flags = 0x000a HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/c (default) = 0x000a native = `c:' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/d (default) = 0x000a native = `d:' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home (default) = 0x000a native = `D:\Users' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/tmp (default) = 0x000a native = `C:\Tmp' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/users (default) = `D:\Users' flags = 0x000a HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin (default) = 0x000a native = `C:\Apps\cygwin\bin' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib (default) = 0x000a native = `C:\Apps\cygwin\lib' HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options (default) = `' a: fd N/AN/A c: hd NTFS 30733Mb 22% CP CS UN PA FC System d: hd NTFS 63224Mb 75% CP CS UN PA FC Data e: cd N/AN/A f: net NTFS 207132Mb 87% CP CS UN PA FC EMC Dynamic g: net NTFS 207132Mb 87% CP CS UN PA FC EMC Dynamic h: net NTFS 311283Mb 91% CP CS UN PA FC Data i: net NTFS 276176Mb 86% CP CS UN PA FC DATA j: net NTFS 146788Mb 99% CPUN PA1481 k: net NTFS 279984Mb 33% CP CS UN PA FC Data l: net NTFS 279984Mb 33% CP CS UN PA FC Data m: net NTFS 207132Mb 87% CP CS UN PA FC EMC Dynamic n: net NTFS 311283Mb 91% CP CS UN PA FC Data o: net NTFS 28137Mb 4% CP CS UN PA FC Data p: net NTFS 172609Mb 100% CP CS UN PA FC DATA q: net NTFS 55796Mb 57% CP CS UN PA FC Data r: net NTFS 63224Mb 75% CP CS UN PA FC Data s: net NTFS 345221Mb 77% CP CS UN PA FC DATA t: hd NTFS 152625Mb 42% CP CS UN PA FC IOMEGA_HDD u: net NTFS 345221Mb 77% CP CS UN PA FC DATA v: net AFS2097151Mb 51% CP CS AFS y: net AFS2097151Mb 51% CP CS AFS C:\Apps\cygwin / system binmode Y: /afs system binmode D:\annex/annex system binmode C:\apps /apps system binmode c: /c system binmode d: /d system binmode D:\Users/home system binmode C:\Tmp /tmp system binmode D:\Users/users system binmode C:\Apps\cygwin\bin /usr/bin system binmode C:\Apps\cygwin\lib /usr/lib system binmode . /cygdrive userbinmode,cygdrive Found: C:\Apps\cygwin\bin\bash.exe Found: C:\Apps\cygwin\bin\cat.exe Found: c:\Program Files\Hummingbird\Connectivity\9.00\NFSClient\cat.exe Warning: C:\Apps\cygwin\bin\cat.exe hides c:\Program Files\Hummingbird\Connectivity\9.00\NFSClient\cat.exe Not Found: cpp (good!) Found: C:\Apps\cygwin\bin\find.exe Not Found: gcc Not Found: gdb Found: C:\Apps\cygwin\bin\ld.exe Found: C:\Apps\cygwin\bin\ls.exe Found: c:\Program Files\Hummingbird\Connectivity\9.00\NFSClient\ls.exe Warning: C:\Apps\cygwin\bin\ls.exe hides c:\Program Files\Hummingbird\Connectivity\9.00\NFSClient\ls.exe Found: C:\Apps\cygwin\bin\make.exe Found: C:\Apps\cygwin\bin\sh.exe 56k 2000/12/03
Re: export arrays in cygwin ksh
I tried changing case but to no avail. there is no pdksh file in my cygwin/bin directory so I think I am out of luck w/ pdksh. use the Cygwin Setup program and install pdksh. It is not installed by default. -- 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/
Re: export arrays in cygwin ksh
On Tue, 23 May 2006, bob wrote: The filenames may be case sensitive, too -- the executable is called pdksh.exe, not PDKsh.exe. However, if you had followed the Cygwin problem reporting guidelines at http://cygwin.com/problems.html, we would have known what packages you have installed on your system. I tried changing case but to no avail. there is no pdksh file in my cygwin/bin directory so I think I am out of luck w/ pdksh. I ran cygcheck as suggested in the url above. Lots of good info. not sure how to attach the file, but here is a partial listing (hopefully I captured what you are looking for!) Umm, a partial cygcheck output, inline, is not particularly useful. You attach it as you would attach anything else to your email -- the exact procedure depends on your email client (I'd open the help and search for attach). Cygwin DLL version info: DLL version: 1.3.12 DLL epoch: 19 DLL bad signal mask: 19005 DLL old termios: 5 DLL malloc env: 28 API major: 0 API minor: 54 Shared data: 3 DLL identifier: cygwin1 Mount registry: 2 Cygnus registry name: Cygnus Solutions Cygwin registry name: Cygwin Program options name: Program Options Cygwin mount registry name: mounts v2 Cygdrive flags: cygdrive flags Cygdrive prefix: cygdrive prefix Cygdrive default prefix: Build date: Sat Jul 6 02:16:58 EDT 2002 CVS tag: cygwin-1-3-12-1 Shared id: cygwin1S3 YOUCH!!! That would be the first thing I would change about your installation. You are running with a 4(!)-year-old version of Cygwin. Cygwin Package Information [snip] pcre3.7-1 rcs 5.7-3 I have come to realize that there is more than 1 implementation of ksh. Actually, I was mistaken -- there *is* only one official ksh implementation in the current distribution. Others have been proposed, but, for one reason or another, did not make it in. The syntax I used in my example is exactly what I use on my hp unix workstation and it works fine on the hp. I did try to export individual elements like you suggest with no luck. What does ksh -c 'echo $KSH_VERSION' print on your hpux workstation? How about on Cygwin? What is the output of ls -l /bin/ksh.exe? I get blank line for the 1st command, in both cygwin and hpux. You are not using pdksh. for 2nd on cygwin: ls -l /bin/ksh.exe -rwxr-xr-x1 ae5460t Administ 502784 Aug 7 2002 /bin/ksh.exe I don't know where you got this ksh, but it wasn't from an official Cygwin installation. Thus, I would recommend either finding out where your ksh came from (and contacting that venue for support), or installing pdksh (which is what I've been assuming you use, so the recipe below should work). I did find in my installation in the cygwin/bin dir a file ksh.exe which is what I assume it was running. Guess that is not pdksh. PDKsh installs a /bin/ksh symlink if none is present. So it could be pdksh. Please follow the above directions so that we can find out. My own IT people do not know what version of cygwin I am using (I am not laughing!) I will try to find out more info on this. I think we are using redhat, but will dig deeper. Thanks Please read and follow the Cygwin problem reporting guidelines at http://cygwin.com/problems.html. That will tell us the version of Cygwin and various packages in your installation. Your last comment - are you saying I may not be able to export my array data to later processes or script files ? You may try the other ksh packages in Cygwin, and see if they address your problem. Otherwise, the portable solution would be something like # In the parent script for i_ in `seq 0 ${#vname[*]}`; do vname_=$vname_ '${vname[$i_]}'; done # In the child script eval set -A vname $vname_ Umm, ok, I forgot to do export vname_ in the first line, but you must've figured that out, since it worked for you... Tried the portable solution above ... slick solution, it gets the data into the child as a single variable only problem, in cygwin the -A is not available so I may have to brute force the array. I get this error ./test2: line 1: set: -A: invalid option set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...] This sounds like the output from bash, actually... I suspect your /bin/ksh.exe is a copy of bash.exe, but your installation is too old for me to try figuring out whether this is the case. Just upgrade. Thanks for all the help again, and for your patience. As I said, the version of ksh you have in Cygwin is not pdksh. Switch to pdksh, and the above solution will work. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_