2 # no bashisms so it can be used in debian profile run by dash
3 # --start adds to start of path, which will give it highest priority
4 # --ifexists will add to path only if the directory exists
6 local found x y z ifexists start loop
10 # portable substring matching is ugly http://mywiki.wooledge.org/BashFAQ/041
14 if [ "$1" = --start ]; then
16 elif [ "$1" = --ifexists ]; then
30 [ "$x" = "$y" ] && found
=true
34 if ! $ifexists ||
[ -d "$x" ]; then
35 if [ ! "$PATH" ]; then