delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/05/04:17:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>
To: <cygwin AT cygwin DOT com>
Subject: RE: how to add a specified path to PATH
Date: Sat, 5 Jan 2002 03:17:11 -0600
Message-ID: <NCBBIHCHBLCMLBLOBONKOEFBCIAA.g.r.vansickle@worldnet.att.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
In-Reply-To: <XFMail.020105085046.guenther.sohler@newlogic.com>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019