The D0 Environment

The D0 Environment


The D0 environment consists of the following kinds of entities:


Initializing the D0 Environment

The choice of shell in D0 is standardized to the c shell (csh), or a csh-compatible shell, such as tcsh.

To initialize the D0 environment at login time, add the following line to your .cshrc file:

source /usr/local/etc/d0local.cshrc

Also, add the following line to your .login file:

source /usr/local/etc/d0local.login

D0local.cshrc contains definitions of standard D0 aliases and shell variables. D0local.login contains definitions of standard D0 environment variables.

Environment Variables

Environment variables are normally defined in one's .login file. Environment variable definitions are inherited by child processes. The value of environment variables can be determined by programs as well as subshells by calling the standard system routine getenv.

D0 Environment variables are defined by sourcing /usr/local/etc/d0local.login, which is normally done from the user's .login file.

Directory Environment Variables

Environment variables are frequently used to store the locations of significant directories. D0 directory envinorment variables are always specified in lower case. The following is a list of directory environment variables that are defined as part of the D0 environment.
Environment      Default                VMS Logical         
Variable         Value                  Name Equivalent        Description

d0library System D0$DISK: Root of d0library dependent [D0LIBRARY] d0test $d0library/test D0$DISK: Root of d0library [D0LIBRARY.TEST] test releases d0gamma $d0library/gamma D0$GAMMA: or Root of d0library D0$BETA:[GAMMA] gamma releases d0calor_off $d0library/calor_off D0$CALOR_OFF or Root of d0library D0$CALOR_OFF$ROOT section CALOR_OFF dbl3 System System Root of dbl3 dependent dependent data area prod System D0$PROD: Root of production dependent [D0PRODUCTION] release area prodfull_d0reco None PROD$FULL_D0RECO or FULL_D0RECO PROD$FULL_D0RECO$ROOT production release. d0fs_mc D0$DATA$MC Monte Carlo data d0fs_stage DISK$STAGE FATMEN staging area d0fs_pick D0$DATA$PICK Pick events data d0fs_dst, D0$DATA$DST Dst data alpha_dst, alpha2_dst

D0library, test libraries, and search lists.

At login time, an environment variable is defined for each d0library section. By default, these envinorment variables point to the root of the current official release. There are two D0-defined commands, libtest and libprod, that modify the d0library section environment variables to point to test or production releases. Test and production release environment variables may be search lists which point to several different directories. For example:

% nolibtest physics_util
% echo "$physics_util"
/d0library/physics_util

% libtest physics_util
% echo "$d0physics_util"
{/d0library/test/physics_util,/d0library/physics_util}

% libprod full_d0reco
% echo "$d0physics_util"
{/production/full_d0reco/new,/production/full_d0reco,/production/full_d0reco/physics_util}


Other environment variables, notably those that point to D0FS data, may also be search lists.

The above search list syntax is particular to the c shell (csh). Refer to the csh man page for details about how the csh expands such search lists. In general, unlike VMS, csh-style search lists can expand to multiple copies of a file with the same name, or to non-existent files. D0 file-finding utilities may be used to generate behaviour that is nearly equivalent to VMS search lists (i.e. only the first existing instance of a file with a given name is returned).

The PATH Environment Variable

When a command is entered that does not correspond to a built-in shell command or an alias, the shell searches for an executable file with the specified name in a list of directories stored in the environment variable PATH. Many standard UNIX commands are actually executable files stored standard system directoreies.

The D0 environment adds certain directories from d0library containing executable files to the standard PATH environment variable. The root directories of the following d0library sections are added to the PATH environment variable:

Immediately after initializing the D0 environment, only the official release is stored in PATH. Putting a d0library section into or out of test mode using libtest or nolibtest adds or removes the corresponding directory in PATH. D0 UNIX-specific utilities are exclusively stored in the unix d0library section. The other d0library sections in PATH contain executable programs that have been ported from VMS.

Shell Variables

Shell variables are known only to the current shell. Shell variable definitions are not inherited by child processes. Any standard shell variables must be defined each time a new shell is created, typically in one's .cshrc file.

Standard D0 shell variables are defined by sourcing /usr/local/etc/d0local.cshrc. Shell variables are used to store standard options for compilation and linking. They do not normally need to be referred to by users.

Commands

The UNIX shells provide two mechanisms for defining non-shell commands--aliases and executable files. An executable files may be a script or a compiled program. Unlike VMS, there is no command line distinction between built-in shell commands, aliases and executable files.

Aliases

An alias is a short (one-line) command that is invoked by a specified character string and is executed by the current shell. Aliases definitions are not inherited by child processes, but must be refined in each shell, normally in one's .cshrc file.

Standard D0 aliases are defined in /usr/local/etc/d0local.cshrc.

Two reasons for implementing a command as an alias are that it is very simple (e.g. a single command) or if it needs to modify the parent shell's environment variable, shell variable or alias definititions (e.g. libtest). A complete list of D0 defined aliases that modify the parent shell's variables or aliases is given below:

Other D0 defined aliases are given below:

Executable Files

Most D0 UNIX specific utilities are implemented as executable files that reside in the root directory of the unix d0library section. Executable files are executed as separate processes from the parent shell. They inherit a copy of the parent shell's environment variables (not shell variables or aliases). Since they are a separate process, they can not modify any aspect of the parent shell's variables or aliases.

Links to other D0 pages

  • Top of this document.
  • D0 UNIX Page
  • D0 home Page

  • Last updated Sept. 7, 1995.
    H.G.