This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in $PATH initialization?


From the bash manual (in emacs: M-: (info "(bash) Bash Startup Files")):

"When Bash is invoked as an interactive login shell, or as a
non-interactive shell with the `--login' option, it first reads and
executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile',
`~/.bash_login', and `~/.profile', in that order, and reads and
executes commands from the first one that exists and is readable.  The
`--noprofile' option may be used when the shell is started to inhibit
this behavior."

and

"When an interactive shell that is not a login shell is started, Bash
reads and executes commands from `~/.bashrc', if that file exists.
This may be inhibited by using the `--norc' option."

So, in the typical case, when you start bash with '-i', it sources the
following files:
         /etc/profile   # which typically contains PATH initialization
         ~/.bash_profile  # or some other "login" file, such as ~/.profile
         ~/.bash_profile will usually source ~/.bashrc (the non-login code)

To avoid having these files read, start bash with '--noprofile' (if you wish
to avoid reading /etc/profile and ~/.bash_profile) and '--norc' (if you wish
to avoid reading ~/.bashrc.  Or, simply edit /etc/profile and ~/.bashrc,
where PATH is typically set to get PATH to have the ordering that you
want.


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]