Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!hplabs!hao!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn) Newsgroups: net.unix Subject: Re: "Variables" and their settings Message-ID: <6311@brl-tgr.ARPA> Date: Mon, 3-Dec-84 17:54:00 EST Article-I.D.: brl-tgr.6311 Posted: Mon Dec 3 17:54:00 1984 Date-Received: Thu, 6-Dec-84 06:35:59 EST References: <6310@brl-tgr.ARPA> Distribution: net Organization: Ballistic Research Lab Lines: 30 > 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.