evan@pedsgo.UUCP (03/19/87)
I have two ksh questions, that refer to new features that exist only in ksh, as opposed to sh or csh. 1) It is easy to get the contents of an array variable into a string variable: X=${ARRAY[*]}. Do this, and $X contains the entire array, each separated by a space. If you have built the array carefully, this is a nice thing. The question is how to do the opposite; after I have put my array into X, how can I get it back into individual compartments of the array? Specifically, my goal is to put the array into a file, and then later read the array's contents back from the file. I really don't care HOW, just so long as I can. The problem is that I don't know how long the array will be, though I am willing to store the value in ARRAY[0]. It seems that if I can read the array into a string, easy enough to do, I should be able to break it up and put it into the numerical array. Right?? 2) Does anyone know any more about the % and # substring operators? Can you specify these with numeric arguments, rather than with string arguments?? (i.e. all my doc shows is I='file.c', so ${I%.c} cuts off the .c and is equal to 'file'. This is only marginally helpful; is there more to this?) The only documentation I have about these is in Issue 2 of Korn's own abstract. There seems to be no more in the AT&T-style sh(1) documentation for ksh that I have with it. (I have no other ksh documentation.) -- WHO: Evan L. Marcus || "All my life I wanted to be WHAT: Concurrent Computer Corporation, || someone; I guess I should WHERE: Tinton Falls, NJ || have been more specific." HOW: {topaz|hjuxa|vax135}!petsd!pedsgo!evan || -- Jane Wagner