On Monday 29 October 2007 14:33, Thomas Hertweck wrote:
> Randall R Schulz wrote:
> > [...]
> >
> > I use this shell procedure (defined in my .bashrc) to query local
> > variables:
> >
> > vq () {
> >     set | egrep -e "$1"
> > }
>
> Isn't "set" also reporting functions etc.? I usually use "printenv"
> 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...


> Th.


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to