* environment stuff.
@ 2014-11-27 1:23 Ray Andrews
2014-11-27 2:03 ` Bart Schaefer
0 siblings, 1 reply; 14+ messages in thread
From: Ray Andrews @ 2014-11-27 1:23 UTC (permalink / raw)
To: Zsh Users
When you do a complete dump of the environment, there's this
ginormous thing that starts:
typeset -A _comps
_comps=(- _precommand -array-value- _value -assign-parameter-
_assign -brace-parameter- _brace_parameter -command- _autocd
-command-line- _normal -condition- _condition -default- _default ...
... and ends:
_zstyle ztodo _ztodo zxpdf _xpdf zypper _zypper )
What on Earth is it? Where does stuff like that get set?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 1:23 environment stuff Ray Andrews
@ 2014-11-27 2:03 ` Bart Schaefer
2014-11-27 2:25 ` Ray Andrews
0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2014-11-27 2:03 UTC (permalink / raw)
To: Zsh Users
On Nov 26, 5:23pm, Ray Andrews wrote:
}
} When you do a complete dump of the environment, there's this
Let me point out that if you get any "typeset -A ..." then you're NOT
doing a complete dump of the environment. You're doing a complete dump
of the internal parameter space. Some things get copied back and forth
from the internal parameter space to the environment, and you can use
parameter references to examine the environment, but the two are not
the same. The environment is the exported subset of the parameter
space, and you can't export arrays, especially associative ones.
} ginormous thing that starts:
}
} typeset -A _comps
}
} What on Earth is it? Where does stuff like that get set?
That's the list of all command names mapped to functions that implement
the completions for them. It's populated by compinit.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 2:03 ` Bart Schaefer
@ 2014-11-27 2:25 ` Ray Andrews
2014-11-27 3:45 ` Bart Schaefer
0 siblings, 1 reply; 14+ messages in thread
From: Ray Andrews @ 2014-11-27 2:25 UTC (permalink / raw)
To: zsh-users
On 11/26/2014 06:03 PM, Bart Schaefer wrote:
> On Nov 26, 5:23pm, Ray Andrews wrote:
> }
> } When you do a complete dump of the environment, there's this
>
> Let me point out that if you get any "typeset -A ..." then you're NOT
> doing a complete dump of the environment. You're doing a complete dump
> of the internal parameter space. Some things get copied back and forth
> from the internal parameter space to the environment, and you can use
> parameter references to examine the environment, but the two are not
> the same. The environment is the exported subset of the parameter
> space, and you can't export arrays, especially associative ones.
Good to know. I trust this parameter space is off limits and I don't have
to know anything more about it for now?
> } ginormous thing that starts:
> }
> } typeset -A _comps
> }
> } What on Earth is it? Where does stuff like that get set?
>
> That's the list of all command names mapped to functions that implement
> the completions for them. It's populated by compinit.
Such a load of work!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 2:25 ` Ray Andrews
@ 2014-11-27 3:45 ` Bart Schaefer
2014-11-27 22:14 ` Ray Andrews
0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2014-11-27 3:45 UTC (permalink / raw)
To: zsh-users
On Nov 26, 6:25pm, Ray Andrews wrote:
}
} I trust this parameter space is off limits and I don't have
} to know anything more about it for now?
Er, not exactly. Shell scripts refer to parameters all the time.
$1, $2, $*, $@ are all parameters (the "positional" parameters);
parameters with names are variables, like $path, $PS1, and $REPLY;
exported variables are the environment, and at startup time the
environment is [mostly] implicitly imported into variables that
are automatically marked as exported.
Then there are various types of parameters (scalars, arrays, and
associative arrays AKA hashes) and subtypes (integer and float are
scalars, but most scalars are not integer or float).
So you do need to know about what parameters are, but there are a
lot of them whose purpose you might not need to understand if you
aren't directly manipulating a particular shell feature.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 3:45 ` Bart Schaefer
@ 2014-11-27 22:14 ` Ray Andrews
2014-11-27 23:05 ` Bart Schaefer
0 siblings, 1 reply; 14+ messages in thread
From: Ray Andrews @ 2014-11-27 22:14 UTC (permalink / raw)
To: zsh-users
On 11/26/2014 07:45 PM, Bart Schaefer wrote:
> So you do need to know about what parameters are, but there are a
> lot of them whose purpose you might not need to understand if you
> aren't directly manipulating a particular shell feature.
>
I know I need to know what parameters *are*, I mean I don't need to
worry about that giant list of them ;-) ... or, is there something I'd
need to look at via: " typeset -p "? It looks pretty arcane, most of it.
But it looks like you're planning to hide some of that stuff anyway.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 22:14 ` Ray Andrews
@ 2014-11-27 23:05 ` Bart Schaefer
2014-11-28 21:58 ` Roman Neuhauser
0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2014-11-27 23:05 UTC (permalink / raw)
To: zsh-users
On Nov 27, 2:14pm, Ray Andrews wrote:
}
} I know I need to know what parameters *are*, I mean I don't need to
} worry about that giant list of them ;-) ... or, is there something I'd
} need to look at via: " typeset -p "?
I don't think anyone ever LOOKS at "typeset -p" ... it's mostly for
dumping state in a "source"-reloadable way.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-27 23:05 ` Bart Schaefer
@ 2014-11-28 21:58 ` Roman Neuhauser
2014-11-28 22:55 ` Ray Andrews
2014-11-28 23:37 ` Bart Schaefer
0 siblings, 2 replies; 14+ messages in thread
From: Roman Neuhauser @ 2014-11-28 21:58 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-users
# schaefer@brasslantern.com / 2014-11-27 15:05:14 -0800:
> I don't think anyone ever LOOKS at "typeset -p" ...
i do, quite often.
--
roman
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-28 21:58 ` Roman Neuhauser
@ 2014-11-28 22:55 ` Ray Andrews
2014-11-29 10:53 ` Roman Neuhauser
2014-11-28 23:37 ` Bart Schaefer
1 sibling, 1 reply; 14+ messages in thread
From: Ray Andrews @ 2014-11-28 22:55 UTC (permalink / raw)
To: zsh-users
On 11/28/2014 01:58 PM, Roman Neuhauser wrote:
> # schaefer@brasslantern.com / 2014-11-27 15:05:14 -0800:
>> I don't think anyone ever LOOKS at "typeset -p" ...
> i do, quite often.
Interesting. What do you find in there Roman?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-28 22:55 ` Ray Andrews
@ 2014-11-29 10:53 ` Roman Neuhauser
2014-11-29 16:21 ` Ray Andrews
0 siblings, 1 reply; 14+ messages in thread
From: Roman Neuhauser @ 2014-11-29 10:53 UTC (permalink / raw)
To: Ray Andrews; +Cc: zsh-users
# rayandrews@eastlink.ca / 2014-11-28 14:55:47 -0800:
> On 11/28/2014 01:58 PM, Roman Neuhauser wrote:
> > # schaefer@brasslantern.com / 2014-11-27 15:05:14 -0800:
> >> I don't think anyone ever LOOKS at "typeset -p" ...
> > i do, quite often.
> Interesting. What do you find in there Roman?
typeset -p prints variables that are in scope, not just exported ones.
i can nest several expansions and inspect the results as i add each
layer.
--
roman
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-29 10:53 ` Roman Neuhauser
@ 2014-11-29 16:21 ` Ray Andrews
2014-11-30 3:59 ` TJ Luoma
0 siblings, 1 reply; 14+ messages in thread
From: Ray Andrews @ 2014-11-29 16:21 UTC (permalink / raw)
To: zsh-users
On 11/29/2014 02:53 AM, Roman Neuhauser wrote:
> typeset -p prints variables that are in scope, not just exported ones.
> i can nest several expansions and inspect the results as i add each
> layer.
Ah, so a sort of global variable viewer.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-29 16:21 ` Ray Andrews
@ 2014-11-30 3:59 ` TJ Luoma
2014-11-30 4:16 ` Lawrence Velázquez
0 siblings, 1 reply; 14+ messages in thread
From: TJ Luoma @ 2014-11-30 3:59 UTC (permalink / raw)
To: Ray Andrews; +Cc: zsh-users
On 29 Nov 2014, at 11:21, Ray Andrews wrote:
> On 11/29/2014 02:53 AM, Roman Neuhauser wrote:
>
>> typeset -p prints variables that are in scope, not just exported
>> ones. i can nest several expansions and inspect the results as i add
>> each layer.
>
> Ah, so a sort of global variable viewer.
Curious. This addresses a question that I recently had.
I thought that `printenv` showed a list of all known variables and their
values, but I recently realized that it was missing a lot of them.
Q » Is `typeset` what I should use for that? Or is there a better way?
For example, I have sometimes used `printenv > all-vars.txt` to get a
'snapshot' of current variables. Seems like `typeset > all-vars.txt` is
much better. I just compared them and `typeset` shows 291 vs `printenv`
showing 110.
TjL
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-30 3:59 ` TJ Luoma
@ 2014-11-30 4:16 ` Lawrence Velázquez
0 siblings, 0 replies; 14+ messages in thread
From: Lawrence Velázquez @ 2014-11-30 4:16 UTC (permalink / raw)
To: TJ Luoma; +Cc: Ray Andrews, zsh-users
On Nov 29, 2014, at 10:59 PM, TJ Luoma <luomat@gmail.com> wrote:
> I thought that `printenv` showed a list of all known variables and their values, but I recently realized that it was missing a lot of them.
>
>
> Q » Is `typeset` what I should use for that? Or is there a better way?
>
>
> For example, I have sometimes used `printenv > all-vars.txt` to get a 'snapshot' of current variables. Seems like `typeset > all-vars.txt` is much better. I just compared them and `typeset` shows 291 vs `printenv` showing 110.
Not all zsh parameters are exported to the environment. `printenv` only prints those parameters that have been exported. `typeset` prints *all* parameters.
vq
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-28 21:58 ` Roman Neuhauser
2014-11-28 22:55 ` Ray Andrews
@ 2014-11-28 23:37 ` Bart Schaefer
2014-11-29 9:35 ` Roman Neuhauser
1 sibling, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2014-11-28 23:37 UTC (permalink / raw)
To: zsh-users
On Nov 28, 10:58pm, Roman Neuhauser wrote:
} Subject: Re: environment stuff.
}
} # schaefer@brasslantern.com / 2014-11-27 15:05:14 -0800:
} > I don't think anyone ever LOOKS at "typeset -p" ...
}
} i do, quite often.
The entire dump? Or for specific variable names or patterns?
The latter would not surprise me.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: environment stuff.
2014-11-28 23:37 ` Bart Schaefer
@ 2014-11-29 9:35 ` Roman Neuhauser
0 siblings, 0 replies; 14+ messages in thread
From: Roman Neuhauser @ 2014-11-29 9:35 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-users
# schaefer@brasslantern.com / 2014-11-28 15:37:46 -0800:
> On Nov 28, 10:58pm, Roman Neuhauser wrote:
> } Subject: Re: environment stuff.
> }
> } # schaefer@brasslantern.com / 2014-11-27 15:05:14 -0800:
> } > I don't think anyone ever LOOKS at "typeset -p" ...
> }
> } i do, quite often.
>
> The entire dump? Or for specific variable names or patterns?
>
> The latter would not surprise me.
yeah, mostly the latter, though i tend to overuse | grep ... ;)
--
roman
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-11-30 4:27 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 1:23 environment stuff Ray Andrews
2014-11-27 2:03 ` Bart Schaefer
2014-11-27 2:25 ` Ray Andrews
2014-11-27 3:45 ` Bart Schaefer
2014-11-27 22:14 ` Ray Andrews
2014-11-27 23:05 ` Bart Schaefer
2014-11-28 21:58 ` Roman Neuhauser
2014-11-28 22:55 ` Ray Andrews
2014-11-29 10:53 ` Roman Neuhauser
2014-11-29 16:21 ` Ray Andrews
2014-11-30 3:59 ` TJ Luoma
2014-11-30 4:16 ` Lawrence Velázquez
2014-11-28 23:37 ` Bart Schaefer
2014-11-29 9:35 ` Roman Neuhauser
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).