Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
Home Bash Guide for Beginners Bash and Bash scripts Advantages of the Bourne Again Shell Bash startup files | |||||
See also: Interactive shells | |||||
Search the VIAS Library | Index | |||||
Bash startup filesInvoked as an interactive login shell, or with `--login'Interactive means you can enter commands. The shell is not running because a script has been activated. A login shell means that you got the shell after authenticating to the system, usually by giving your user name and password. Files read:
Error messages are printed if configuration files exist but are not readable. If a file does not exist, bash searches for the next. Invoked as an interactive non-login shellA non-login shell means that you did not have to authenticate to the system. For instance, when you open a terminal using an icon, or a menu item, that is a non-login shell. Files read:
This file is usually referred to in ~/.bash_profile: if [ -f ~/.bashrc ]; then . ~/.bashrc; fi See Chapter 7 for more information on the if construct. Invoked non-interactivelyAll scripts use non-interactive shells. They are programmed to do certain tasks and cannot be instructed to do other jobs than those for which they are programmed. Files read:
PATH is not used to search for this file, so if you want to use it, best refer to it by giving the full path and file name. Invoked with the sh commandBash tries to behave as the historical Bourne sh program while conforming to the POSIX standard as well. Files read:
When invoked interactively, the ENV variable can point to extra startup information. POSIX modeThis option is enabled either using the set built-in: set -o posix or by calling the bash program with the --posix option. Bash will then try to behave as compliant as possible to the POSIX standard for shells. Setting the POSIXLY_CORRECT variable does the same. Files read:
Invoked remotelyFiles read when invoked by rshd:
|
|||||
Home Bash Guide for Beginners Bash and Bash scripts Advantages of the Bourne Again Shell Bash startup files |