This is the mail archive of the
mailing list for the Cygwin project.
RE: how to add a specified path to PATH
- From: "Gary R. Van Sickle" <g dot r dot vansickle at worldnet dot att dot net>
- To: <cygwin at cygwin dot com>
- Date: Sat, 5 Jan 2002 03:17:11 -0600
- Subject: RE: how to add a specified path to PATH
> -----Original Message-----
> From: email@example.com [mailto:firstname.lastname@example.org]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:
# Do everything that would be done in non-interactive mode.
# 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
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html