I changed around the LOGNAME so I noticed that doing ‘LOGNAME=ben’ and the ‘env’ displayed it correctly (I changed it back to original) but then when I try to add a new environment variable, nothing is there…
Hm, then I noticed doing ‘echo $variable’ display the value of the variable but how come it is not displayed in ‘env’?
Still not showing up in env… And when I use the command, ‘env’ A is not showing up… I’ve tried it in Ubuntu and OpenSUSE…
This is what I do:
‘env’ A doesn’t show up
‘set’ nothing comes up with set at all, I basically get code that is similar to C++ and Java
1A) set A=B
2A) ‘env’ still no A
Does it not appear or something? This is really confusing to be honest…
Like I’ve already stated I can easily change the present variables in the system. Like LOGNAME, when I do LOGNAME=ben it changes. I use ‘env’ and then it shows up changed, but when I add a NEW env variable it’s not present in there.
I am using the default shell which is bash. Like I’ve already stated. I’ve tried exporting and the new variable is not created. I’ve tried all other ways and even the way it says in the Linux+ book that I have. Still nothing, and the same was for Ubuntu and in SuSE.
This is what I do I’ve done it many times:
A) export A=B
Still once again, nothing appears. How am I using a c shell when I use the command ‘echo $0’ it prints out ‘bash’?
I do not have any variables to export… I just want to finish this chapter and as I am moving along I am stuck here. I do not know why… But it’s really annoying.
This answer may be a bit old, but figured it would help for other puzzled penguins. From my readings a child process cannot alter the environment of the parent process. The way to get around it is to have the parent process execute the commands directly. This is simple just call:
From my reading, the export keyword tells bash to pass that environment variable to other child processes.