From: Alexander Barton Date: Sun, 6 Jan 2013 17:22:35 +0000 (+0100) Subject: Only add optional paths to PATH if .not_in_path does not exist X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ConfigScripts.git;a=commitdiff_plain;h=659ed6dc3316ccd136f966d84bb7a7def6901bc2;hp=2c48ddad1d00bd4c2dd36499a616c87ca18bab54 Only add optional paths to PATH if .not_in_path does not exist --- 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