"Variables" and their settings

Will Martin wmartin at brl-tgr.ARPA
Tue Dec 4 07:56:53 AEST 1984


I'd like some guidance on how variables are set. We've had some discussion
over on net.news about the ORGANIZATION variable, which is used to determine
the info shown in a posting header. It seems that people using csh can do a
"setenv ORGANIZATION "Any old string"" and get it to take on their next
posting, thus leading to random "anonymous" posting info (there was a 
philosophical discussion of this which is unimportant here).

Anyway, I am here on a system running BRL's version of 4.2 BSD, with a 
"plain" shell as my standard shell. I can do all sorts of variable setting
with commands like "TERM=xyz" and "export TERM" and get the terminal type
variable set as needed. However, when I tried doing the same with the
ORGANIZATION variable, it had no effect, until I put that pair of commands
into my .profile file; then it worked.

Correspondents told me to use "set" instead of the straight command
ORGANIZATION="USAMC ALMSA" and exporting that variable. I tried that,
and found that "set" by itself provided a list of variables and how they
were set (was this also resetting anything to the original defaults 
when I ran that?). But I couldn't get a command like:
set ORGANIZATION "USAMC ALMSA" 
to have any effect. (At least that I could see, both with and without
exporting afterwards.)

There doesn't seem to be any manual pages for "set" or "setenv"; at least
not findable by "man set" -- can someone enlighten me on what the differences
are between the ways of setting variables? Why use one versus the other?
It's all rather mysterious. I know of three ways:
1) Use straight VARIABLE=value followed by export VARIABLE commands.
2) Use set VARIABLE value.
3) Use setenv VARIABLE value.

Are there more? #3 works only in csh, right? Do #s 2 & 3 require "export"
comands following them, or is that how they differ from #1?
Why would there be a difference if the variable is set by the .profile
file versus being set in the shell after the login is finished?

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?

Advice and guidance appreciated!

Regards,
Will Martin

USENET: seismo!brl-bmd!wmartin     or   ARPA/MILNET: wmartin at almsa-1.ARPA



More information about the Comp.unix mailing list