getenv and array question 
Author Message
 getenv and array question

I have a shell variable that is an array.
Is there a way with getenv() to get all
the values in the array?

Suppose the varialble is called XNAME.
If I do getenv("XNAME") all I get is
the first element of the array.

tom foregger
--



Sun, 13 Jul 2003 09:07:47 GMT  
 getenv and array question

Quote:
>I have a shell variable that is an array.
>Is there a way with getenv() to get all
>the values in the array?

Neither getenv() nor the rest of your application knows anything about
your shell variables.  Only the environment variables can be accessed
from the program.

Dan
--
Dan Pop
CERN, IT Division

Mail:  CERN - IT, Bat. 31 1-014, CH-1211 Geneve 23, Switzerland
--



Sun, 13 Jul 2003 12:53:19 GMT  
 getenv and array question

Quote:



> >I have a shell variable that is an array.
> >Is there a way with getenv() to get all
> >the values in the array?

> Neither getenv() nor the rest of your application knows anything about
> your shell variables.  Only the environment variables can be accessed
> from the program.

<OFFTOPIC>
In sh-derived shells (sh, bash, ksh), shell variables can be
"exported" so that they appear in the environment.  ksh supports
one-dimensional array variables.  In ksh, if you export an array
variable, the corresponding environment variable gets the value of the
first array element.

If you want arrays in the environment, you can use multiple
environment variables ($ARR_0, $ARR_1, ...), or you can use a single
environment variable with a delimiter between the values
($PATH=/usr/local/bin:/bin:/usr/bin).
</OFFTOPIC>

The value of any environment variable is a single string.

--

San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
MAKE MONEY FAST!!  DON'T FEED IT!!
--



Fri, 18 Jul 2003 13:41:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. getenv() question

2. some primitive questions about the getenv() and file handling functions

3. some primitive questions about the getenv() and file handling functions

4. some primitive questions about the getenv() and file handling functions

5. char array (array of array...) question

6. Question about adding an array to existing array.

7. Question: extern *array and array[]

8. "getenv"

9. GETENV no longer supported

10. getenv()

11. getenv q2

12. getenv() causing problems

 

 
Powered by phpBB® Forum Software