Shell Variables

Shell variables are an alternative way to pass preferences to Modeler. They are included for completeness, but are less convenient than the other mechanisms, and are less likely to be used. Shell variables provide a good mechanism for setting a preference temporarily (i.e., for the lifetime of the current command interpreter) that is to be passed to a number of programs (or to many invocations of the same program).

The assignment syntax for shell variables of the four basic preference types is shown below. The syntax in the first table applies to the C Shell (/bin/csh) available in Linux. The alternate Korn Shell (/bin/ksh), Bourne Shell (/bin/sh), or T Shell (/bin/tsh), which have a slightly different syntax for shell variable assignments. The second table illustrates Windows command interpreter (cmd.exe) syntax.

Table 11: Assignment Syntax for Linux Shell Variables

Type Syntax Example
integer setenv <attr_name> <int_value> setenv size 345
double setenv <attr_name> <double_value> setenv mean_anomaly 214.6
string setenv <attr_name> <string_value> setenv orb_name statkeep
setenv site_name "QTH"
boolean setenv <attr_name>
setenv <attr_name> <boolean_value>
setenv verbose OFF
setenv verbose TRUE

Table 12: Assignment Syntax for Windows Shell Variables

Type Syntax Example
integer set <attr_name>=<int_value> set size=345
double set <attr_name>=<double_value> set mean_anomaly=214.6
string set <attr_name>=<string_value> set orb_name=statkeep
set site_name=QTH
boolean set <attr_name>=<boolean_value> set verbose=OFF
set verbose=TRUE

Notice that the short form of boolean preferences permitted by command line flags (i.e., just including the flag without a subsequent value argument) is not supported by all shells or interpreters. Also note that quotes should not be used when setting string values in Windows.

The syntax for assigning a sequence of values to list preferences using shell variables requires delimiters to separate individual values; the delimiter character is the colon (":"). An example of a string list preference that is being assigned via a shell variable is shown below; in this case the ef preference will be assigned three strings ("base_orb_defs", "low_earth_defs", and "options").

setenv ef "base_orb_defs:low_earth_defs:options"

Under some circumstances, the automatic parsing of shell variables is undesirable. For instance, a shell variable assignment that is not related to Modeler may conflict with a preference with the same name, thus overriding the proper assignment from the preferences file. This is most likely to occur for preferences with short names, such as sys. In such cases, the conflict can be resolved at the expense of losing access to all shell variables for preference assignments. The parsing of shell variables by the environment package can be disabled by setting the special boolean preference no_shell to TRUE (this preference will only have its intended effect if assigned within the preferences file, as shown below).

	no_shell: TRUE