Mailinglist Archive: opensuse (4288 mails)
| < Previous | Next > |
Re: [opensuse] How to get list of variables
- From: Aaron Kulkis <akulkis00@xxxxxxxxxx>
- Date: Mon, 29 Oct 2007 21:54:57 -0400
- Message-id: <47268EF1.3060507@xxxxxxxxxx>
Randall R Schulz wrote:
But then you have to fork off the sed or grep command, and then
do write(2) into and read(2) out of the pipe, so I'm not seeing
any increased efficiency there when compared to env or printenv.
Could it be that this was a hack from the late 70's early 80's
that you've just become used to doing, and never re-evaluated
whether it is still necessary (or even most efficient)?
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
On Monday 29 October 2007 14:33, Thomas Hertweck wrote:
Randall R Schulz wrote:
[...]Isn't "set" also reporting functions etc.? I usually use "printenv"
I use this shell procedure (defined in my .bashrc) to query local
variables:
vq () {
set | egrep -e "$1"
}
to query (environment) variables...
That's true (though I don't think there's anything left in the "etc." category besides local variables and function definitions), so if I query a name found in a function definition, I'll get spurious results. But it's usually pretty easy to spot and ignore them.
But the point of "vq" (value query) vs. "eq" (environment query) is to be able to distinguish the two. The second function I gave is restricted to exported variables (which by definition excludes shell functions).
And printenv is a standard command, thus requiring a(nother) fork / exec to invoke. Export doesn't, so it has lower overhead. It's of little real consequence, but some of us are still efficiency freaks...
But then you have to fork off the sed or grep command, and then
do write(2) into and read(2) out of the pipe, so I'm not seeing
any increased efficiency there when compared to env or printenv.
Could it be that this was a hack from the late 70's early 80's
that you've just become used to doing, and never re-evaluated
whether it is still necessary (or even most efficient)?
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |