ResourcesSoftwareToolsDebuggersPerformance Programming Editors GNU Tools Shells & Scripting |
Shells and ScriptingThis page describes the UNIX user environment on NERSC computers. Included are pointers to web resources related to the standard shells. Additional shells, not always supported by the vendors, have been installed by NERSC and include the tcsh and bash shells. A number of scripting languages are also available, including TCL, Python, and Perl. Related InformationNERSC Defined EnvironmentA default user home directory is created on each machine. The home directory should always be referred to by the shell environment variable: $HOME Login EnvironmentsYou can change shells through the NIM web interface; see Change Default Login Shell. With the POSIX shells (sh and ksh), when a login shell is opened commands are read first from /etc/profile and then from .profile in the user home directory. Next commands are read from the file named by the ENV parameter (usually file .kshenv in the user home directory). With the C shell (csh), when a login shell is opened commands are read first from /etc/csh.cshrc and then from .cshrc and .login in the user home directory. The /etc/profile and /etc/csh.cshrc files define the default system environment and initialize modules. Please see the introductory page on modules. Some important initializations must be done in the user's startup or "dot" files. Template dot files, located in the directory /usr/common/usg/etc/skel are placed in a new user's home directory. It is very important that users avoid redefining paths and environment variables set in these dot files. ![]() When login shells are started they read information from the files shown above following the route shown by the black arrows. NERSC strongly recommends that users have their initialization files execute via the path of the red arrows shown above. See the next section: User Modifications to the Environment. User Modifications to the EnvironmentWith the use of modules users do not in general need to modify their UNIX initialization files in order to use different software packages. See the Modules web page for more information. If a user wishes to add to the initialization files that were supplied when their account was created, it is recommended that they source $HOME/.cshrc.ext from their default $HOME/.cshrc file (similarly for .login and .profile) and then make all modifications in the $HOME/.cshrc.ext file only. For example, these line should be at the end of a $HOME/.cshrc file: if ( -f $HOME/.cshrc.ext ) then source $HOME/.cshrc.ext endif POSIX shell users can source the .profile.ext with these lines in the $HOME/.profile file. if [ -f $HOME/.profile.ext ] then . $HOME/.profile.ext fi In order to avoid confusion between system and user modifications to the environment variables, users should alway make changes by way of augmentation rather than redefinition of the PATH, etc. For example, in the $HOME/.cshrc.ext file, add your directories to the path as follows: set path = ($path /project1/bin /project2/bin) For users of a POSIX shell, the way to modify a path in the ~/.profile.ext file is: PATH=$PATH:/project1/bin:/project2/bin Troubleshooting and Cautions
|
![]() |
Page last modified: Sat, 01 Mar 2008 02:13:46 GMT Page URL: http://www.nersc.gov/nusers/resources/software/os/shells/ Web contact: webmaster@nersc.gov Computing questions: consult@nersc.gov Privacy and Security Notice |
![]() |