This is the mail archive of the
mailing list for the Cygwin project.
Re: adding a folder to my path
- From: Andrew DeFaria <Andrew at DeFaria dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 02 Jan 2013 12:00:12 -0800
- Subject: Re: adding a folder to my path
- References: <50E46BDD.email@example.com>
On 1/2/2013 9:18 AM, LMH wrote:
I think this is a cygwin question, though it is certainly a general
linux question as well. I would like to divide up and organize some of
the apps and links in my path directories (such as /usr/local/bin)
into sub directories. If I add a folder to /usr/local/bin, that folder
is not in my path. Can someone give me the instructions for adding a
folder such as /usr/local/bin/ruby_viewer/ to my path?
This is a basic question that is shell specific and all.
What I do is I have a function, called append_to_path:
if [ -d "$component" ]; then
if [ -z "$PATH" ]; then
It appends to the PATH IFF the component passed in is a directory that
exists. This allows me to loop through a set of directories knowing that
only those that exist will end up on the path:
systemroot=$(cygpath -u $SYSTEMROOT)
for component in $path_dirs; do
This allows me to set my PATH from scratch exactly how I want it. I add
Unix paths, Solaris paths, HP_UX paths, FreeBSD paths and Windows paths
to path_dirs. The net result is that I get the right set of paths on
each of these systems dynamically.
Andrew DeFaria <http://defaria.com>
This space for rent
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple