Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: auto-reflesh $PATH
- X-seq: zsh-users 11231
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: auto-reflesh $PATH
- Date: Sun, 04 Mar 2007 00:32:14 +0100
- In-reply-to: <c12037010703031514h2730c96te5b721188deda41d@xxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Operating-system: Linux 2.6.19.2-suspend2+ipw2200 i686
- References: <c12037010703031514h2730c96te5b721188deda41d@xxxxxxxxxxxxxx>
Kazuhiko Uebayashi <kzhk75@xxxxxxxxx>:
> Is it possible to reflesh $PATH "automatically" in Zsh?
> If possible, what should I do?
>
> In my environment,
> echo $PATH
> /home/kazu/local/bin:/usr/local/bin:/usr/bin:/bin
> echo $path
> /home/kazu/local/bin /usr/local/bin:/usr/bin:/bin
>
> In Bash, I put some executable file in $PATH
> then the executable file immediately works.
Actually, new binaries, that are put into your path _will_ work
immediately. But the $PATH is not automatically re-hashed.
That is why the completion code won't find matches. And this is also,
why zsh's autocorrection feature (set correct) will try to present
"corrected" commands, instead of the one you entered.
'hash -r' rehashes the $PATH.
Yet, you are looking for something automatic.
Bart Schaefer presented a solution for this and compsys in
zsh-users #8059¹.
If you also need a solution for the autocorrection issue, it would be
possible to wrap code around the 'accept-line' zle widget, that checks
if the first word on the commandline is in ${(k)commands},
${(k)builtins} etc., and if it's not automatically issue 'hash -r' for
you.
While this won't solve every problem, it would sure catch the most
common ones.
Regards, Frank
¹ <http://www.zsh.org/mla/users/2004/msg01066.html>
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author