Suse 9: Shell initialization

The initialization scripts of the shells in SuSE Professional 9have functions and login similar to the ones of other Linux distros and Unix flavours.
Let's analyze them.

/etc/profile (every shell)
Is the common init script for every shell. It sets a number of environment variables system settings. It's generally not a good idea to modify it, since there are various other dedicated files for custom settings. It:
- Checks the shell by which is invoked (this file is common to every shell) and assigns the shell's name to the is variable.
- Sets $TERM=linux and other terminal parameters with stty and tset
- Sets umask = 022
- Sets and exports the environment variables: HOST CPU HOSTNAME HOSTTYPE OSTYEP MACHTYPE
- Sets some ulimits: disactivates core file dumps and provides (commented) some default settings for maximum data, stack and RSS sizes of processes.
- Sets and exports the default PATH (PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin, to which are added sbin directories only for UID 0 (root). It also checks the existence of various directories and adds them to the PATH f they exist: $HOME/bin $HOME/bin/$CPU /var/lib/dosemu /usr/games /opt/bin /opt/gnome/bin /opt/kde3/bin /opt/kde2/bin /opt/kde/bin /usr/openwin/bin /opt/cross/bin
- Sets and exports INPUTRC=$HOME/.inputrc OR, if doesn't exist a .inputrc file in the user's home, INPUTRC=/etc/inputrc.
- Sets and exports HISTSIZE=1000
- Sets and exports TEXINPUTS for Tex/Latex
- Sets and exports variables for the default pages (less): LESSOPEN LESSCLOSE LESS LESSKEY PAGER LESS_ADVANCED_PREPROCESSOR
- Sets and exports MINICOM="-c on"
- Sets and exports MANPATH
- Sets and exports INFOPATH INFODIR (they are equal: /usr/local/info:/usr/share/info:/usr/info
- Sets and exports XKEYSYMDB XNLSPATH (for old motif applications)
- If /etc/nntpserver exists sets and exports NNTPSERVER
- If /etc/organization exists sets and exports ORGANIZATION
- Sets and exports COLORTERM=1 (used by mc)
- Checks if there exist scripts in the /etc/profile.d directory and executes them if they end with .sh.
- Checks if /etc/SuSEconfig/profile exists and executes it (this script is generated by Yast and shouldn't be edited directly)
- (This option is commented by default) Checks if /etc/profile.dos exists and executes it (this script adds  an alias for various typical DOS commands giving an explanation of their alternatives in the Unix world). For Windows users it can be useful to uncomment this.
- Checks if /etc/profile.local exists and executes it (this file doesn't exist by default and can be used for customization)
- Checks if /etc/bash.bashrc and $HOME/.bashrc exist and executes them (only if the shell is bash).
- Checks if /etc/ksh.kshrc and $HOME/.kshrc exist and executes them (only if the shell is ksh).

/etc/inputrc (And $HOME/.inputrc for custom codes)
Sets the key bindings for various terminals (linux, xterm, gnome, kvt) for the readline library that handles user's inputs in an interactive shell.

/etc/profile.d/ (every shell)
In this directory SuSE places various scripts for different programs and adds different suffixes for different shells. Here you find scripts like alias.ash (simulates the alias function under ash), mc.csh mc.sh (used by mc under sh and csh), cvs.sh (sets up environment variables for cvs).
In this way every single package can easily install its own init scripts adapted to different shells (the ones with suffix .sh are always run, the others run only with the relevant shell).

/etc/SuSEconfig/profile
This file sets some important environment variables according to what is configured under /etc/sysconfig and should not be edited manually:
- Sets and exports LANG QTDIR WINDOWMANAGER

/etc/bash.bashrc (every shell)
Despite its name, this script is sourced by every shell in SuSE 9 and does various things:
- Sets the dircolors according to the master configuration file /etc/DIR_COLORS and exports LS_COLORS LS_OPTIONS. If you want to customize your listing colors you can override its settings with the file $HOME/.dir_colors
- Sets the prompt format (PS1) for various shells and some aliases.
- If it exists, executes /etc/bash.bashrc.local (by default is null and can be used by custom general settings)

$HOME/.bashrc (bash only)
This can be changed by every user and, in SuSE9, is always executed with the bash shell (other Unixes use this only in interactive shels). By default it:
- esecutes /etc/profile.dos with some aliases useful for DOS users;
- executes $HOME/.alias if it exists, for custom alias definitions.
It has also various (commented) settings, for exporting PILOTRATE PILOTPORT EDITOR

$HOME/.profile (every shell)
This is custom for every user and is executed in every login shell. The default file (stored in /etc/skel for replication in the home of every new user) is entirely commented and has already set few fuctions to uncomment: exporting for a custom, local LANG and activation of fortune at the login (by default is disabled).

Privacy Policy