6.2. StartupBash, like other shells, is a program. When a new Bash shell starts, it executes commands in the file ".bashrc" in the home directory of the user running Bash. The one exception is when Bash is started as a login shell, in which case it runs the commands in the file ".bash_profile" in the user's home directory instead. So if you want your ".bashrc" file to be executed in your login shell as well, you have to add this to your ".bash_profile" file: if [ -f ~/.bashrc ]; then . ~/.bashrc fi We'll see how and why that works later in the chapter. This is often found by default in ".bash_profile" files on a system. In addition to these two files, the system administrator can put initialization commands appropriate for all users in the file "/etc/profile" which Bash will also read and execute. Note that Bash will read the "/etc/profile" file first, before running any initialization files belonging to the user. |