Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: uninvited members of associative array




On 2022-12-16 13:15, Dominik Vogt wrote:

But variables are not even a real part of the shell, the shell
script or its data.  Every process has an associated environment
that consists of "key=value" pairs.  The parameter syntax in the
shell is just a way to manipulate the environment that is then
passed to the started processes.  The environment exists
independently of the shell.

Sure, but the shell manipulates that environment, which is what we want it to do.  And the various expansions are surely entirely zsh's own doing.  I don't think there's anything to disagree about really.  I do take your point tho.  zsh is not comparable to, say, C.  At first I thought it would be and it took a while to beat that out of me.

To begin with, the shell does not even have a fixed syntax that
could be written down in a rule book:
I've noticed!  The parser code must be formidable.
Then, the commands that the shell runs are mostly not defined by
the shell but externally.  You'd probably describe the script

   ls .
   rm -f foobarbaz

as "a program that lists non-hidden entries of the current
directory and then removes the entry foobarbaz if it exists and is
not a directory".  But that is not true.  What the script really
does is "execute a program 'ls' with argument '.', then execute a
program 'rm' with arguments '-f' 'foobarbaz'".  What the called
programs do is not part of the shell.  So, unless you want to
define the program as a sequence of "execute X with arguments Y1
... Yn" the shell really doesn't do anything close to what the
"program" is supposed to do.

I understand.  The shell is for interacting with command line binaries and friends.  But it's internal power is such that it can get a whole lot done.  I remember in C when you had to call an external program it was ... 'unnatural', but of course zsh is exactly the opposite -- it is a facilitator of external programs.







Messages sorted by: Reverse Date, Date, Thread, Author