Make path checking on startup faster by only using builtin commands

darcs-hash:20070928213821-75c98-65fb9e2159bfef7ab04468511378ac3efbf2308e.gz
This commit is contained in:
liljencrantz 2007-09-29 07:38:21 +10:00
parent 3a73b60956
commit db0a982570

View File

@ -62,14 +62,11 @@ switch $USER
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
end
# Make a regular expression that matches any component in the PATH. A
# trailing slash is ok. The sed call is to remove the last '|'.
set -l tmp (printf "%s" \^$PATH'/?$|')
set -l path_regexp \((echo $tmp | sed -e "s/.\$//")\)
for i in (printf "%s\n" $path_list|sgrep -E -v $path_regexp)
if test -d $i
set PATH $PATH $i
for i in $path_list
if not contains $i $PATH
if test -d $i
set PATH $PATH $i
end
end
end