"Variables" and their settings
Doug Gwyn <gwyn>
gwyn at brl-tgr.ARPA
Tue Dec 4 08:54:00 AEST 1984
> I'd like some guidance on how variables are set. ...
I just typed
ORGANIZATION="USAMC ALMSA" export ORGANIZATION
on the BRL 4.2BSD (both the native and SVR2 Bourne shells) and it worked fine.
This is the proper way to emulate csh's "setenv" while using the Bourne shell.
The "export" command need not be given on the same line as the assignment.
There is no reason that this command would have to be in a .profile to work.
It is always possible that there is a bug in your copy of the shell; if you
have access, you might copy the latest version from either BRL-TGR or BRL-VGR.
"set" shows what is set; it does not set anything. It is documented in the
manual entry for "sh" (since it is of necessity built into the shell).
"setenv" is the Cshell way of setting environment variables, and its "set"
(not the same as the Bourne shell's!) is used to set "local" shell variables.
> Is there an unlimited number of these variables, and do they have to be all
> upper-case? Any way to get a listing of them all?
Of course there is some practical limit to ANYthing, but it is sufficiently
large that your need not worry about it on a VAX. "set" lists them all, as
well as defined "shell functions" (a SVR2 feature). "export" lists just
those variables that will be added to the "environment", i.e., that are
globally exported to processes run by the shell. "readonly" lists those
variables that cannot be changed (only works correctly with SVR2 or later).
There is no case restriction on either local shell variables or environment
variables; the use of upper case for environment variables is a convention.
More information about the Comp.unix
mailing list