FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 05-26-2012, 02:50 AM
Philip Ashmore
 
Default Exported (ba)sh functions in the environment

Hi there.

I recently had cause to search for an environment variable to see if it
was being set.
As a result I noticed that the environment has become a bit of a dumping
ground for
installed programs where configuration files would have been a cleaner
option.


Looking for an override in the environment is of course a good idea, but
setting

default values in the environment that could be

1. hard coded in the programs as defaults
2. stored in a configuration file
3. sourced from a configuration script

is a bit sloppy.

On my machine running "set > set.txt && ls -lsa set.txt" reveals that my
environment contains 225517 of "stuff" - some of it is even being taken
up by

exported function definitions!

That's 225517 bytes that needs to be copied every time a script runs.

Regards,
Philip Ashmore


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FC044DA.90706@philipashmore.com">http://lists.debian.org/4FC044DA.90706@philipashmore.com
 
Old 05-26-2012, 02:56 AM
Ben Hutchings
 
Default Exported (ba)sh functions in the environment

On Sat, May 26, 2012 at 03:50:02AM +0100, Philip Ashmore wrote:
[...]
> On my machine running "set > set.txt && ls -lsa set.txt" reveals that my
> environment contains 225517 of "stuff" - some of it is even being
> taken up by
> exported function definitions!
>
> That's 225517 bytes that needs to be copied every time a script runs.

No. 'env' shows the environment variables.

Ben.

--
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert Camus


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120526025656.GZ4038@decadent.org.uk">http://lists.debian.org/20120526025656.GZ4038@decadent.org.uk
 
Old 05-26-2012, 02:59 AM
Philip Ashmore
 
Default Exported (ba)sh functions in the environment

On 26/05/12 03:50, Philip Ashmore wrote:


That's 225517 bytes that needs to be copied every time a script runs.


Yeah that should read "every time a script or program runs."

Philip


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FC0472E.70007@philipashmore.com">http://lists.debian.org/4FC0472E.70007@philipashmore.com
 
Old 05-26-2012, 03:09 AM
Philip Ashmore
 
Default Exported (ba)sh functions in the environment

On 26/05/12 03:59, Philip Ashmore wrote:
> On 26/05/12 03:50, Philip Ashmore wrote:
>>
>> That's 225517 bytes that needs to be copied every time a script runs.
>
> Yeah that should read "every time a script or program runs."
>
> Philip
>
Sorry Ben, our emails collided.

According to "man sh" (which links to the dash man page)

set [{ -options | +options | -- }] arg ...
The set command performs three different functions.

With no arguments, it lists the values of all shell variables.

So are these copied every time a script runs?

Philip


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FC0495D.6070000@philipashmore.com">http://lists.debian.org/4FC0495D.6070000@philipashmore.com
 
Old 05-26-2012, 03:14 AM
Russ Allbery
 
Default Exported (ba)sh functions in the environment

Philip Ashmore <contact@philipashmore.com> writes:

> According to "man sh" (which links to the dash man page)

> set [{ -options | +options | -- }] arg ...
> The set command performs three different functions.

> With no arguments, it lists the values of all shell variables.

> So are these copied every time a script runs?

Only exported shell variables become part of the environment. The rest
are local to the specific shell. "env" will show just the environment.

I'm curious why even your set of shell variables is so large, though. My
environment is only 1699 bytes on a system I logged onto via ssh, and 1998
on my desktop (running Xfce). One of the biggest chunks of that is
LS_COLORS.

--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87mx4vr5uz.fsf@windlord.stanford.edu">http://lists.debian.org/87mx4vr5uz.fsf@windlord.stanford.edu
 

Thread Tools




All times are GMT. The time now is 05:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org