From 659ed6dc3316ccd136f966d84bb7a7def6901bc2 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 6 Jan 2013 18:22:35 +0100 Subject: [PATCH] Only add optional paths to PATH if .not_in_path does not exist --- sys/profile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/profile b/sys/profile index 6849ee5..67b6314 100644 --- a/sys/profile +++ b/sys/profile @@ -49,24 +49,33 @@ fi # prepend optional directories to PATH ... path="" for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do - [ -d "$d" -o -h "$d" ] && path="$path$d:" + if [ -d "$d" -o -h "$d" ]; then + [ -e "$d/.not_in_path" ] || path="$path$d:" + fi done [ -n "$path" ] && PATH="$path$PATH" if [ "$UID" -eq 0 ]; then path="" for d in /usr/pkg/sbin /opt/*/sbin; do - [ -d "$d" -o -h "$d" ] && path="$path$d:" + if [ -d "$d" -o -h "$d" ]; then + [ -e "$d/.not_in_path" ] || path="$path$d:" + fi done [ -n "$path" ] && PATH="$path$PATH" fi # append optional directories to PATH ... for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do - [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d" + if [ -d "$d" -o -h "$d" ]; then + [ -e "$d/.not_in_path" ] || PATH="$PATH:$d" + fi done # set PATH so it includes user's private executables -[ -d ~/Applications ] && PATH=~/Applications:"${PATH}" -[ -d ~/bin ] && PATH=~/bin:"${PATH}" -[ -d ~/sbin ] && PATH=~/sbin:"${PATH}" +[ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \ + && PATH=~/Applications:"${PATH}" +[ -d ~/bin -a ! -e ~/bin/.not_in_path ] \ + && PATH=~/bin:"${PATH}" +[ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \ + && PATH=~/sbin:"${PATH}" # Setup MANPATH, if manpath(1) isn't available if [ ! "$(type manpath 2>/dev/null)" ]; then -- 2.39.2