commit 157b503e1d2327ba474aa906e1420d053cb93620
parent e849df54459a12b2552ebb58bd71d86fc756a975
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 17 Nov 2020 09:33:55 +0100
.profile: don't add the same dir to path more than once
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.profile b/.profile
@@ -199,7 +199,9 @@ ot() {
addtopath() {
for d in "$@"; do
if [ -d "$d" ]; then
- PATH="${d}:${PATH}"
+ if ! printf %s "${PATH}" | grep -q "${d}:"; then
+ PATH="${d}:${PATH}"
+ fi
fi
done
}