This is the mail archive of the cygwin@cygwin.com 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: how to add a specified path to PATH


> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Guenther Sohler
>
> Assuming you are using bash(this is the default)
>
> put following stetement into your ~/.bashrc file
>
> export PATH=$PATH:<newpath>
>
> <newpath> is the new path
>

Actually I think it's probably marginally better to do it in .bash_profile (of
course assuming you're using bash as your login shell) like this:


.bash_profile:

# Do everything that would be done in non-interactive mode.
source $HOME/.bashrc

....

# The path already has stuff in it, but
# we can add to it here if we need to.
export PATH=<more paths>:$PATH:<still more paths>

....


The idea here is to load up as much stuff as possible into .bash_profile, which
is only run once per bash window you start, as opposed to .bashrc, which will be
run not only then but also in any sub-bash's you may end up spawning.  At the
same time, since you've done the export, any subshells (bash or not) will still
get the right path (in fact if you're setting PATH in .bashrc it'll double in
length in every level of sub-bash you spawn).

Now since /bin/sh isn't bash anyway, you're probably not spawining any
sub-bashes, so the issue is largely academic.  But still.

--
Gary R. Van Sickle
Brewer.  Patriot.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]