Home > Linux > 更新 zsh 的 command hash table

更新 zsh 的 command hash table

November 14th, 2009 Leave a comment Go to comments

zsh 下新装了一个软件,tab 补全时新装软件的命令不会出现。以前的解决办法是执行 export PATH=$PATH 让 zsh 去更新缓存。

今天在 Pylons 的 activate 脚本里看到了一条 builtin 命令 hash (man zshbuiltins),这条命令可以直接修改 command hash table。$PATH 路径下的内容发生变化时可以用 hash -r 来更新。

Tags: ,
  1. pidgin
    November 15th, 2009 at 00:14 | #1

    hash [ -Ldfmrv ] [ name[=value] ] …
    hash can be used to directly modify the contents of the command hash table, and the named directory hash table. Nor‐
    mally one would modify these tables by modifying one’s PATH (for the command hash table) or by creating appropriate
    shell parameters (for the named directory hash table). The choice of hash table to work on is determined by the -d
    option; without the option the command hash table is used, and with the option the named directory hash table is used.

  2. pidgin
    November 15th, 2009 at 00:15 | #2

    sorry, from man zshbuiltins
    if u remember there is a command in bash with the same name -,-b

  3. November 21st, 2009 at 10:23 | #3

    终于知道这个了,不过居然是通过Python框架的文档知道的,太囧了。

    现在有Pylons的需要了么?

  4. chenyufei
    November 23rd, 2009 at 19:09 | #4

    没有,不过做了一点 Pylons 和 Django 的比较。觉得 Pylons 更适合我,也更喜欢 Pylons 的 approach。

    话说不是文档里看到的,而是框架 virtualenv 的 activate 脚本里看到的。

  1. No trackbacks yet.