mscdsetup — Set up the shell and environment for the MSS mscd command
mscdsetup [-project proj] { -sh | -ksh | -csh }
This command is used to initialize the user's shell and environment before use of the mscd(1NCAR) command.
The UNIX cd command is somewhat unique in that it is directly performed by the user´s shell. Thus, to get similar behavior, the mscd command must also be performed in some fashion by the user´s shell. To accomplish this, the mscd command must be a shell function (for sh or ksh) or an alias (for csh or tcsh) that calls another command. This auxiliary command, mscdsetup, is used both to initialize the shell and to perform the actual directory change operation.
Initially, you must cause the mscdsetup command to be run before
any use is made of mscd. This can be done explicitly or implicitly via
a shell startup file. (The Bourne and Korn shells only execute your
$HOME/.profile at login time, not when subshells are
started). When mscdsetup is run, it initializes the NCAR_MSSPWD
environment variable that the mscd alias or function requires.
See the appropriate Examples
section below for details.
Once mscdsetup has been run, it is possible to use the mscd command. If mscdsetup is not run, all other commands assume the working directory is your MSS home directory.
proj
Supply proj as the project number for
charging. Currently, no charging is done for metadata operations, so
this option is a placeholder for when charging might be imposed.
Example 7. Bourne shell specific mscdsetup.
Bourne users (sh) need to run the following statement each time a new shell is started, either explicitly (sh script or if script is directly executable) or implicitly via a subshell (command inside parentheses):
eval `mscdsetup -sh`
This defines mscd as a shell function.
Example 8. Korn shell specific mscdsetup.
Korn shell (ksh) users need to use the ENV
environment variable to specify a file to be run when each
shell is started. We recommend that this file reside in
your home directory. The file (named, in this example,
$HOME/.msenv) must contain the
following line:
eval `mscdsetup -ksh`
Then, place these two lines in your $HOME/.profile file:
ENV=$HOME/.msenv export ENV
This defines mscd as a shell function and exports it to subshells.
Example 9. csh/tcsh shell specific mscdsetup.
Users of csh or tcsh need to place the following statement in
their $HOME/.cshrc file (and also in any
script that uses the -f option):
eval `mscdsetup -csh`
This defines mscd as an alias.
Example 10. Using a shell alias to run mscdsetup.
Some shells provide command aliases. This is a convenient way to initialize your shell for using the mscd command. Specific details for your shell may differ. Here is how to initialize an alias for csh or tcsh:
alias mssetup 'eval `mscdsetup -csh`'
Notice the difference between the single quote (') and
the backquote (`). Then you can just
type mssetup when you want to use the mscd
command.
See Environment Variables section of the Command Behavior and Envrionment chapter for details.
See Exit Status Codes section of the Command Behavior and Environment chapter for details.