For example, if I make a parameter expansion:$ b=1$ echo $b1Where is b stored internally? I checked and it is not an environment variable because it is not listed by printenv. I'm writing my own shell to learn Unix and I used a hashtable to store and retrieve variable as a symbol lookup table - is that method a good method or would you suggest me some other way?
Where are shell variables stored?
shell;variable
The shell being run when you log in to read your commands and run them keeps all the variables.  If you run a 2nd shell, then it will have its own collection of variables.  You can run the set command to see a list of the variables.  The set command runs inside the shell instead of launching a new process.Environment variables are either kept in a separate space or flagged as such (if it matters, then read the shell source code) so they are passed along the programs being run by the shell.Using two hashtables seems reasonable to me.