PWD Environment Variable

I set many environment variables within my shell configuration files but my question is this:

What sets the built-in "PWD" environment variable (ex: $PWD)? I never set it. It was already there after I installed FreeBSD. It seems like no matter what shell I use, the "PWD" environment variable is already set.

Another question:
What sets a lot of these built-in environment variables?
 
So if I am using C Shell, the csh executable is hard-coded to set these built-in environment variables?
 
All shells have some built-in variables to automate some commonly used tasks like figuring out the current working directory in a shell script or for providing means to customize the shell by user, PWD is just one of them. Look up the Environment section in the csh(1) manual page. The bourne shell sh(1) has a similar but somewhat different set of built-in variables, in the manual page they are listed under Special Variables and Environment.
 
Back
Top