Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

10.0;setvar, revision 1.0, 88/01/21
setvar (set_variable) -- Set the value of a variable
usage: setvar {[-type {str|int|bool|any|env}] var_name value ... | variable/value_list}



DESCRIPTION
     The setvar command takes pairs of arguments, which may be preceded by an
     optional  type-specifier (-type type).

     By default, the type of each variable specified in the setvar command
     depends on the  type  of  each  input value.  However, you can use the
     -type argument to specify the individual type(s) of the the variables.


NOTE
     If a value is not of the type specified by the -type argument, an error
     results.

     For more information on variables, refer to the manual Using Your Aegis
     Environment.


ARGUMENTS
     variable_list (optional)
                    Specify the names of the variables that receive the input
                    values.

                    Default if omitted:  must specify -type (below)

OPTIONS
     -type type var_name...
                    Specify the type of the input value(s) that can be
                    assigned to  the  particular  variable  name(s).
                    Multiple variable names are permitted, separated by
                    blanks.  Once you specify a type in a particular setvar
                    command, setvar assigns that type to all subsequent
                    variable names, until you change the type specification.
                    Valid types are:

                    str[ing]        Character strings
                    int[eger]       Integer numbers
                    bool[ean]       Boolean values
                    env[ironment]   Environment variables
                    any             Any type (the default)

                    If  the  type  of  the  input value does not match the
                    type specified for that variable name, setvar issues an
                    error and asks you to enter another input value. Use -type
                    any to restore the shell to its default state. In this
                    case, it determines the proper variable type
                    automatically.

                    Specifying -type env var_name causes the variable to
                    become an environment variable.

EXAMPLES
     In the first example, we create several variables using setvar and then
     list them using the lvar command.

     $ setvar i 1                          # an integer
     $setvar b true                        # a boolean
     $ setvar s1 string                    # a string
     $setvar -type string s2 true          # a boolean forced into a string
     $lvar i b s1 s2
     integer i = 1
     boolean b = true
     string s1 = string
     string s2 = true

     In this example, we set several variables of different types and then
     list them.

     $ setvar -type int i1 1 i2 2 -type str s1 3 s2 4 -type any i3 1
     $ lvar i1 i2 s1 s2 i3
     integer i1 = 1
     integer i2 = 2
     string s1 = 3
     string s2 = 4
     integer i3 = 1


     The following is an error message example.  In this case, we are trying
     to set an integer to a string.

     $ setvar -type int z ten
     ?(sh) semantic error - 'ten' is not an integer.



SEE ALSO
     More information is available.  Type

     help  eoff     For details  about  restricting  variable  evaluation  to
                    within variable expressions

     help  eon      For details about enabling global variable evaluation

     help  existvar For details about existing variables

     help  export   For information about environment variables

     help  dlvar    For information about deleting a variable

     help  read     For information on assigning multicharacter strings to
                    variables

     help  readc    For information on assigning whole-line strings to
                    variables

     help  readln   For information on assigning whole-line strings to
                    variables

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026