Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: auto-reflesh $PATH



On 3/4/07, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

    function preexec {
      local -a modified_path
      modified_path=( ${^path}(Nms${SECONDS}) )
      SECONDS=0
      if (( $#modified_path ))
      then hash -r
      fi
    }

That won't catch files being renamed within the same directory in $PATH,
but if you have a lot of directories or a lot of commands in the path it
is probably faster than doing a rehash before every command.

I guess it's time someone writes an inotify module.  Any takers?

 nikolai



Messages sorted by: Reverse Date, Date, Thread, Author