[Techtalk] environ variable in C

David Sumbler david at aeolia.co.uk
Sat Apr 3 09:56:32 EST 2004


On Fri, 2 Apr 2004, Akkana Peck wrote:

> David Sumbler writes:
> > I'm carrying on with my attempts to learn C.
> >
> > I've just been experimenting with a little program to print out the
> > contents of the "environ" variable.
> >
> > For some reason it doesn't print all of my bash environment variables
> > - it prints rather less than half of them.
>
> Are you sure those are all environment variables?  They're all
> exported, they're not just bash shell variables?

Oops - I confess I hadn't thought of that.  How "newbie" can you get?!!

>  Does the printenv command print more variables than your C program?

No, it doesn't, so your surmise was correct.  I confess, I wasn't
aware of "printenv" - I've tended to use "set" or "declare" to list
the variables, hence the inclusion of unexported items.

David

-- 


More information about the Techtalk mailing list