Tuesday, March 10, 2009

058 通过HISTCONTROL变量去除历史记录中的重复记录

上面将的例子中虽然可以去除重复的历史记录,但是条件是这些重复记录必须是连续出现的。要去除整个历史记录中所有的重复记录可以将HISTCONTROL 设置为erasedups:
# export HISTCONTROL=erasedups

# pwd

# service httpd stop

# history | tail -3
38 pwd
39 service httpd stop
40 history | tail -3

# ls -ltr

# service httpd stop

# history | tail -6
35 export HISTCONTROL=erasedups
36 pwd
37 history | tail -3
38 ls –ltr
39 service httpd stop
40 history | tail -6

[Note: The previous service httpd stop after pwd got
erased]

No comments:

Post a Comment