When you execute a shell program that program executes in a new process (with a unique PID). When it exits, anything it has done to the environment is lost (which is why you don't see the
export). The exit status of that program is returned to the calling process (your shell).
Now, that's if you simply type the name of the program and hit the carriage return. If you run a program with a leading
dot-space, called a
Dot Command, it will execute in your current PID and whatever it does to the environment will be available at exit.
You can also include an exit line with a value that you'd like returned to the shell (note that this will most likely kill your shell if you use a Dot Command to execute it):
Code:
echo "This is something."
exit 10
Then do
If you had a shell program,
prog, that includes an "export" (but not an exit value) you would execute it with
Then
to see that value.
Hope this helps some.