diff options
author | axel <axel@liljencrantz.se> | 2006-05-18 23:00:17 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-05-18 23:00:17 +1000 |
commit | 4a06821d995ec657e9927082c0636451b0bb2102 (patch) | |
tree | 39f919baee72e3b4fc9dccc2dbf626bef079436a /share | |
parent | 22f3dcfd354cab2e4d8c579a54eb3f7aaa5d9b66 (diff) |
Make fish remove invalid PATH entries on startup, and give a warning about it
darcs-hash:20060518130017-ac50b-9326ed6b5671bbe0285fd2d5604e4ea69087c7c1.gz
Diffstat (limited to 'share')
-rw-r--r-- | share/fish.in | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/share/fish.in b/share/fish.in index 1e33f1f5..9418cbcf 100644 --- a/share/fish.in +++ b/share/fish.in @@ -5,6 +5,29 @@ # # +# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish. +# + +set -g fish_function_path $PWD/functions/ + +# +# Make sure there are no invalid entries in the PATH +# + +set -l erase_idx +for idx in (seq (count $PATH)) + set i $PATH[$idx] + if not test -d $i + set erase_idx $erase_idx $idx + printf (_ '%s: Warning: The directory %s has been removed from your PATH, because it does not exist\n') fish $i + end +end + +if count $erase_idx >/dev/null + set -e PATH[(echo $erase_idx)] +end + +# # Add a few common directories to path, if they exists. Note that pure # console programs like makedep sometimes live in /usr/X11R6/bin, so we # want this even for text-only terminals. @@ -27,12 +50,6 @@ for i in $path_list end # -# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish. -# - -set -g fish_function_path $PWD/functions/ - -# # Don't need completions in non-interactive mode # |