AIR Wiki : ShellStartupFiles

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Shell Startup Files


Introduction


In this page the used shell startup files will be discussed. Our startpoint is that the environment should be the same for non-interactive, interactive and login shells. This should make it easier and more scalable to run remote commands via SSH or MPI, a.o. used to run network tests.

In the following sections the startup files will be discussed that have been used to define the environment for regular users and to set the shell dependent settings. For each shell a separate section will be used. For clearness reasons some unused startup files will not be mentioned. See the man pages for more details.

[t]csh


At startup the following files will be read by these shells, in this order:
  1. /etc/csh.cshrc
  2. /etc/csh.login
  3. $HOME/.cshrc
  4. $HOME/.login

The *cshrc files will be read by all shells while the *login files are only read by login shells.

There will be assumed that the root user does not use rcsh as login shell. Therefore, in /etc/csh.cshrc the user environment and some settings for interactive shells are defined. The file /etc/csh.login is ignored because it will only be read by login shells.

zsh


At startup the following files will be read by zsh, in this order:
  1. /etc/[zsh/]zshenv
  2. $HOME/.zshenv
  3. /etc/[zsh/]zprofile
  4. $HOME/.zprofile
  5. /etc/[zsh/]zshrc
  6. $ZDOTDIR/.zshrc
  7. /etc/[zsh/]zlogin
  8. $HOME/.zlogin

The sub directory zsh will only be used by Debian Linux.

The *zshenv files will be read by all shell types, the files *zshrc for interactive shells and the *zprofile and *zlogin files will be used for interactive shells. This implies that the user environment will be defined in /etc/[zsh/]zshenv while settings for interactive shells will be defined in /etc/[zsh/]zshrc. The other files in /etc will not be used.

For similarity reason asn for the ease of use the same user settings startup files will be used for zsh and the bash shell which will be treated in the next section. As the root user also has a bash login shell the user settings will only be defined for non-root users.

This has been implemented as follows: when the user ID is non-zero the following files suited for zsh and bash will be sourced:


bash


At startup the following files will be read by bash, in this order:
  1. For interactive login shells:
    1. /etc/profile
    2. $HOME/.bash_profile
    3. $HOME/.bash_login
    4. $HOME/.profile
  2. For interactive non-login shells:
    1. $HOME/.bashrc

This behaviour has not been appreciated very much. Therefore, the skeleton file for new bash users, /etc/skel/.bash_profile, has been modified such that $HOME/.bashrc will be sourced. And on its turn with the /etc/skel/.bashrc skeleton file /etc/bashrc will be sourced.

This makes it possible to define the user environment and shell settings completely in /etc/bashrc. This has been done by sourcing for non-root users the following files, in this order:
  1. /etc/bash_zsh_env.user
  2. /etc/bash_zsh_rc.user
See the zsh section for more details.

With bash it is not easy to define an environment for non-interactive shells.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0242 seconds