shell profile script code example

Example: shell profile

# There are the following initialization files for bash shells:

$ /etc/profile
      # The systemwide initialization file, executed for login shells
$ /etc/bash.bashrc
      # The systemwide per-interactive-shell startup file
$ /etc/bash.bash.logout
      # The systemwide login shell cleanup file, executed when a login shell exits
$ ~/.bash_profile
      # The personal initialization file, executed for login shells
$ ~/.bashrc
      # The individual per-interactive-shell startup file
$ ~/.bash_logout
      # The individual login shell cleanup file, executed when a login shell exits
$ ~/.inputrc
      # Individual readline initialization file

# Purpose

# system-wide defaults for..
	1. /etc/profile ..login shells, for interactive shells with login
	2. /etc/bashrc ..non-login Bash shells
    
# user-specific defaults in home directory ~ for..
	1. ~/.profile ..login shells, called after login
	2. ~/.bashrc ..non-login shells, if already logged in
	3. ~/.bash_profile ..login shells, called after login (lower priority)

# user-specific defaults in home directory for login and logout
	1. ~/.bash_login ..login shells (called upon login)
	2. ~/.bash_logout ..login shells (called upon logout)