From: "Dog Walker" <forestiero@qwest.net>
To: linux-newbie@vger.kernel.org
Subject: Adding to the PATH but not if already in $PATH
Date: Sat, 26 Feb 2005 10:17:00 -0800 [thread overview]
Message-ID: <200502261017.00466.forestiero@qwest.net> (raw)
I want to prepend a directory to my PATH in my $HOME/.bashrc and export the
result. But I only want it to happen once: iow, if a directory I want
prepended is already in the PATH, do not prepend it again.
Something like:
if "/home/dw/bin" not in $PATH ; then
PATH=/home/dw:$PATH
export PATH
fi
The questions are: Is this the way one guards against multiple additions in
subshells? Is there a way to check for a substring?
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next reply other threads:[~2005-02-26 18:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-26 18:17 Dog Walker [this message]
2005-02-26 19:05 ` Adding to the PATH but not if already in $PATH Eric Bambach
2005-02-26 19:40 ` DogWalker
2005-02-26 20:34 ` Eric Bambach
-- strict thread matches above, loose matches on Subject: below --
2005-02-26 18:16 Dog Walker
2005-02-26 22:44 ` chuck gelm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200502261017.00466.forestiero@qwest.net \
--to=forestiero@qwest.net \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox