[Next] [Previous] [Up] [Top] [Contents] [Index]

Chapter 9: Working Environment

9.4 Tailoring Your Environment

This section discusses the FUE-customized login files (also called the Fermi files) used to set up your UNIX environment. All the files discussed in this section are printed in Appendix C. You will automatically have your own copy of these files in your home directory[42]. The default files exist in /usr/local/etc and you can recopy them to your home directory if you ever need to. Once you understand the functions of the various files, you can tailor them to suit your tastes.

Many of these files include sample code that you may want to activate. A pound sign (#) in the first column indicates a comment line. To activate a command line that's been "commented out", remove the #.

9.4.1 C Shell Family Fermi Files

The C shell executes hidden FUE-customized files at various times in your session. They include the files .cshrc and .login, which you may choose to further modify.

When you log out, the shell looks for a logout script in your home directory called .logout. FUE does not provide this file, but you can create it yourself, and it will get run automatically. This file is not required.

As an example, including the clear command in your .logout file contents clears the screen when you logout.

[Missing image]If your system is running AFS, we recommend including the unlog command in the .logout file. This is explained in section 7.3.4.

.cshrc and fermi.cshrc

Upon logging in, the first file to execute is the .cshrc located in your home directory. The shell also executes this file each time you invoke a new C shell, for example when you execute a C shell script or otherwise fork a new process.

Your .cshrc file first executes /usr/local/etc/fermi.cshrc, which:

fermi.cshrc also calls /usr/local/etc/local.cshrc which may set other environment variables.[43] You do not have a copy of fermi.cshrc in your home directory; it is not designed to require individual customization. See section C.1.2 for the file listing.

The file .cshrc should contain all your aliases so that child processes have access to them; many suggested aliases are provided for you to activate, and you can define your own. You can also set shell variables (noclobber and ignoreeof are already set for you) and parameters that are local to a shell.

Don't set any environment variables here. Any changes to their values will remain after you terminate a forked process, thus changing your standard environment for the duration of your login session. See section C.1.1 for the default file listing.

.login and fermi.login

The .login file is executed only at login time. After execution of .cshrc, the .login file located in your home directory is run. The default .login file first executes the file /usr/local/etc/fermi.login.

fermi.login performs several actions:

You do not have a copy of fermi.login in your home directory; it is not designed to require individual customization. See section C.1.6 for the file listing.

Next, the .login file sets your prompt, and sets the variables history and savehist. You can edit your .login to modify your path and/or terminal settings, change the default values of environment variables or create your own, and/or include commands that you want to execute once, at the beginning of each session (for instance setup product commands). See section C.1.5 for the default file listing.

.logout

The C shell executes the .logout file in your home directory (if you have created one) when you log off the system.

Execute files to modify current session

If you modify your .cshrc or .login files and you want them to take effect in the current session, you must execute them with the source command:

% source .cshrc
% source .login 

This is explained in section 4.4.

9.4.2 Bourne Shell Family Fermi Files

The Bourne shell executes hidden FUE-customized files at various times in your session. When you log on in the Fermi environment, the .profile and .shrc files in your home directory are executed for sh, bash, and ksh. Your .shrc file is also executed at any time a new bash or ksh is invoked.[44]

The name of the file .shrc is determined by the ENV environment variable which is set to ~/.shrc in the standard .profile, it is not a standard UNIX feature.

.profile and fermi.profile

The .profile file first executes /usr/local/bin/fermi.profile. This file performs several actions:

You do not have a copy of fermi.profile in your home directory; it is not designed to require individual customization. See section C.2.2 for the file listing.

The .profile file sets your prompt and the variables that govern your history list, your default editor, and your command line editor. You can edit your .profile to modify your path and/or terminal settings, change the default values of variables[45] or create your own, and/or include commands that you want to execute once, at the beginning of each session (for instance setup product commands). See section C.2.1 for the default file listing.

.shrc and fermi.shrc

The .shrc file first executes /usr/local/etc/fermi.shrc which sets up UPS and performs some machine-dependent functions. See section C.2.5 for the default file listing.

The .shrc file should contain all your aliases[46] so that child processes have access to them; many suggested aliases are provided for you to activate, and you can define your own. You can also set variables (noclobber and ignoreeof are already set for you except in sh) and parameters that are local to a shell, and you can activate and define functions. See section C.2.4 for the default file listing.

Execute files to modify current session

If you modify your .shrc or .profile files and you want them to take effect in the current session, you must execute them with the . command:

$ . .shrc
$ . .profile 

This is explained in section 4.4.

9.4.3 Storing Customized Code

If you wish to maintain versions of distributed code customized to your own needs, we recommend that you store them in the following directories:

$HOME/bin

for machine-neutral code

$HOME/bin.$ARCH

for architecture-specific code; $ARCH is the value returned by funame -s (e.g., SunOS, IRIX).

The path names for these directories will be added to your PATH when the Fermi files are invoked.


[42] Exceptions are the fermi.* and setup.* files which are called directly from /usr/local/etc.
[43] This is a file for things that the local system manager wants to add to the login scripts. It may or may not have been created on your system.
[44] On some of the more recent OS releases (e.g., AIX+4 and IRIX+6.4, and likely others in the near future) /bin/sh is a link (links are described in section 6.3.5) to the korn shell (ksh). ksh is a superset of sh, so this shouldn't present any problems for you. One difference is that your .shrc file gets sourced when you run /bin/sh scripts.
[45] Remember for sh, there is not really a difference between shell and environment variables; see section 9.1.
[46] Aliases are available for bash and ksh, but not for sh; see section 9.3.2.

UNIX at Fermilab - 10 Apr 1998

[Next] [Previous] [Up] [Top] [Contents] [Index]