


     Set (1.3/2.x/3.x internal)  


            NB: I was unable to test this properly with 1.3. I 
        would appreciate anyone who has tried it to please help 
        me correct the problems.

     NAME
          Set - Set or clear the value of an environment variable.

     SYNOPSIS
          Set varname [string]

     DESCRIPTION

            First, let's discuss what an environmental variable 
        is. It is a named text string which stores an 
        environmental space and is accessible only to the Shell 
        from which it was created. To have that variable to be 
        accessed by any program or CLI (hence, a global variable) 
        then use the SETENV command.  SETENV stores the variable 
        in the private system memory, while Set stores it in the 
        RAM.

            This is different from environment variables created 
        with the new V1.3 "SetEnv" and "GetEnv" commands.  
        Programs which use the arp.library environment variables 
        will be able to read variables set by either "Set" or 
        "Setenv".

            To set the value of an environment variable, simply 
        use SET VARNAME=VAL, which sets the value of VARNAME to 
        VAL.  To remove this environment variable do Set VARNAME= 
        or Set VARNAME. There is no limit to the number of 
        variables you can set and clear with one command.  You 
        can intermix setting and clearing variables on the same 
        command line.

            To view the values of all current environment 
        variables, simply use Set without any arguments.

            You can use spaces in your variable names and values, 
        but it is not generally a good idea.  If you do use 
        spaces, you must surround the complete expression with 
        double quotes, i.e., "Variable Name=Variable Value". Note 
        that the similar looking expression "Variable Name = 
        Variable Value" has hidden spaces.  The Variable ends 
        with a space, and the value begins with one. This is only 
        one example of how problematical spaces in environment 
        variables and values can become.

            Set also has special features for setting the Escape 
        character. You can set the current escape character by 
        using the ESCAPE <char> keyword.

            One source of problems with old script files and 1.3, 
        2.x, and 3.x is the use of the star "*" to refer to the 
        current window.  Pre 1.3 programs tend to regard the star 
        "*" as a wildcard, as is common.  If you use the BCPL 
        keyword to do SET BCPL TRUE, those programs which tend to 
        have problems with this will attempt to overlook the "*" 
        as a wildcard.

            Finally, you can get a listing of all variables, 
        including the values of ESCAPE and BCPL by using the 
        keyword LISTALL.

            Under 2.x/3.x there are several environmental 
        variables which are automatically set for you, or which 
        you may set for yourself. These are:

            Process: The process number of the current shell 
        or task.

            RC : The Return Code of the last command executed. 
        This lets you examine some code without using the IF WARN 
        or IF FAIL commands.

            Result2: The error number that will indicate why the 
        last command failed. The FAULT command may be used to 
        interpret these.

            Echo: This local environment controls whether or not 
        the Shell repeats each command as you execute it. If Echo 
        is SET on, the commands are repeated. If you set it to 
        anything else or not at all they are not repeated. 
        Turning this on is a good way to debug your scripts that 
        don't work. Many times there is really no other way to 
        see why they failed. Echo will print each line as it 
        executes and will tell you which ran properly, and which 
        didn't.

            To remove a variable, you may use the UNSET command.

            EXAMPLE
          Set DODAH=SONG dateformat=0 copyflags= ESCAPE \

          The command line above creates or redefines the variable
          DODAH to have the value SONG, dateformat to have the value
          0, removes the variable copyflags from the environment, and
          sets the current ESCAPE character to \.

     ADDITIONAL CONSIDERATIONS
            The Shell also has builtin environment variable 
        expansion and assignment features.


