mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 11:22:52 +08:00
Update the PATH checking code to work in batch mode
darcs-hash:20060518133726-ac50b-81759f01565fdfdb85c042c1db1b766a9a6adcda.gz
This commit is contained in:
parent
763a6b8351
commit
db459f869a
|
@ -40,12 +40,14 @@ if test "$USER" = root
|
|||
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
|
||||
end
|
||||
|
||||
for i in $path_list
|
||||
set -l regex "^$i\(\|/*\)\$"
|
||||
if not printf "%s\n" $PATH|grep $regex >/dev/null
|
||||
if test -d $i
|
||||
set PATH $PATH $i
|
||||
end
|
||||
# Make a regular expressin that matches any component in the PATH. A
|
||||
# trailing slash is ok. The sed call is to remove the last '\|'.
|
||||
|
||||
set -l path_regexp \\\((printf "^%s\\(\\|/\\)\$\\|" $PATH | sed -e "s/..\$//")\\\)
|
||||
|
||||
for i in (printf "%s\n" $path_list|grep -v $path_regexp)
|
||||
if test -d $i
|
||||
set PATH $PATH $i
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user