如何过滤掉 tcsh 历史记录中的相同命令

问题描述

我正在使用 tcsh。但对存储在历史文件中的相同命令感到恼火。我不得不多次使用向上箭头来绕过相同的命令,非常不方便。 任何人都可以提供一些帮助来解决这个不便。

解决方法

histdup 设置;来自tcsh(1)

   histdup (+)
           Controls handling of duplicate entries in the history list.  If
           set to `all' only unique history events are entered in the
           history list.  If set to `prev' and the last history event is
           the same as the current command,then the current command is
           not entered in the history.  If set to `erase' and the same
           event is found in the history list,that old event gets erased
           and the current one gets inserted.  Note that the `prev' and
           `all' options renumber history events so there are no gaps.