You are here: Foswiki>Computing Web>MacOSX>MacOSXLoginScripts (revision 4)EditAttach

What is run when BASH starts

See the Invocation section of man bash for a description of BASH's behaviour (attached below).

Login sessions are started by invoking BASH with the --login option or with the first option starting with -

Interactive is whenever you start BASH to get to a command prompt.

Non-interactive is when you run a bash script, with this invocation, the bashrc and profile login scripts are not rerun (there is a way to get an initialization script run in this instance, but that is a specialized use that I've never seen used...). You can create a non-interactive login shell by giving the proper options to BASH, though I don't see why you would want to.

(For the exact details of the above see the man page).

Interactive Login Shell

  • The system /etc/profile is run. On many systems this script invokes /etc/bashrc Note that BASH itself doesn't invoke /etc/bashrc.
  • The first and only the first found of ~/.bash_profile, ~/.bash_login, or ~/.profile is run.

Interactive Non-login shell

  • The user's ~/.bashrc is run.

What XTerm and Terminal do on MAC

xterm produces an Interactive Non-login shell. xterm -ls produces an interactive login shell. Terminal gives you an interactive login shell. These follow the rules above.

-- TomRockwell - 01 Jun 2007
Topic attachments
I Attachment Action Size Date Who Comment
bash-invocation.txttxt bash-invocation.txt manage 4.6 K 01 Jun 2007 - 20:56 TomRockwell Section of BASH man page
Edit | Attach | Print version | History: r8 | r5 < r4 < r3 < r2 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r4 - 01 Jun 2007, TomRockwell
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback