VICAR Login Script Interactions [PREVIOUS] [TOP] [NEXT]

4.1 VICAR Interactions with Login (.cshrc) Scripts

We are frequently asked how to set up UNIX system and user login scripts so that users can start VICAR simply by typing vicar at the prompt. Here are some recommendations and ideas.

When we refer to a system login script we mean one that's centrally located, called by all users´ .cshrc login scripts. If you don´t already have such a script, we recommend you create one. If most of your users will be running VICAR, put the VICAR setup commands that follow in the system login script. Otherwise, put them in individual users´ .cshrc scripts.

The best way to set up VICAR is to check for V2TOP´s existence in the system or usersı login script. Run vicset1.csh only if V2TOP has not been set. This is why VICAR setup is split into vicset1.csh and vicset2.csh; vicset1 is run only once, while vicset2 is run every time a subshell is created.

Here´s part of a C shell login script that also incorporates the VICAR-ISIS compatibility setup. If you don´t have ISIS, you can delete the isisset.csh or isis alias lines.

 if ($?V2TOP == 0) then
   setenv V2TOP /usr/local/vicar/vicar1601
   source $V2TOP/vicset1.csh
   source $V2TOP/isisset.csh
source $V2TOP/vicset2.csh
alias isis 'if ($?DISPLAY == 0) xterm -e idl &; taetm'

vicset1.csh adds a number of directories to the path environmental variable. These must be preserved. If path or other ³path-like² environmental variables such as LD_LIBRARY_PATH and XFILESEARCHPATH are set unconditionally in either the user or system log in scripts:

set path = (~/Perl ~/bin ~/special)
setenv LD_LIBRARY_PATH /usr/dt/lib:/usr/openwin/lib

then directories previously added by vicset1 will disappear in a subshell, such as when a new window is opened. However, even if path is extended, rather than set unconditionally:

set path = ($path ~/Perl ~/bin ~/special)

another, though much less serious, problem is created. Every time a subshell is created, PATH is re-extended. This may eventually produce a "ridiculously long path truncated" error message when starting a subshell.

To solve both problems, we recommend that you change the usersı and system login scripts so that PATH is only extended once per session. A variable used as a flag can be checked. You must have one flag variable for the system login script and another for a user login script if path is set in both places.

if ($?PATHSET == 0) set path = ($path ~/Perl ~/bin ~/special)
setenv PATHSET

You have three other choices for setting up VICAR, though the first two will slow down subshell creation:

  1. Always run both vicset1.csh and vicset2.csh (and isisset.csh if needed) in the system login script. However you must still check all users´ login scripts for unconditional path setting. These scripts must be changed so that path or path-like variables are extended (see above).
  2. Always run both vicset1.csh and vicset2.csh (and isisset.csh if needed) in the user login scripts after path, LD_LIBRARY_PATH and XFILESEARCHPATH are set. In this case even if the user sets the path variables unconditionally it won´t interfere with VICAR setup.
  3. You can avoid all user login script modifications by creating a separate script to setup VICAR manually. This is the method we use at MIPS. For example, create a script called /usr/local/vicar_setup:
setenv V2TOP /usr/local/vicar/vicar16
source $V2TOP/vicset1.csh
source $V2TOP/vicset2.csh
source $V2TOP/isisset.csh

This script can be given an alias such as "vicar_setup" in the system login script:

>alias vicar_setup "source /usr/local/vicar_setup"

Do not use "vicar" as the alias, since that name is already aliased to "taetm" in vicset2.csh. Of course the user must remember to run this script before using VICAR.

This is a useful technique if you have more than one version of VICAR. For example, create a script called /usr/local/vicar_setup:

source $V2TOP/vicset1.csh
source $V2TOP/vicset2.csh
source $V2TOP/isisset.csh

Then create separate aliases for each version of VICAR:

alias vicar_set16 setenv V2TOP /usr/local/vicar/vicar16; \
source /usr/local/vicar_setup"
alias vicar_set15 setenv V2TOP /usr/local/vicar/vicar15; \
source /usr/local/vicar_setup"


#!/bin/csh -f.
Next: Defining Environment Variables
Previous: Reference Information for UNIX Install
Top: VICAR Installation Table of Contents
Updated Thu May 8 13:29:32 1997 by Larry Bolef