jul 31
FreeBSD 默认的 shell 是 /bin/csh,相对于 Linux 下广泛使用的 /usr/ports/shell/bash 来说,默认设置的 /bin/csh 使用起来不太友好。比如命令补全功能,需要这样的设置。 /bin/csh 的历史命令功能是非常强大的:
For example, consider this bit of someone's history list:
9 8:30 nroff -man wumpus.man
10 8:31 cp wumpus.man wumpus.man.old
11 8:36 vi wumpus.man
12 8:37 diff wumpus.man.old wumpus.man
The commands are shown with their event numbers and time stamps. The
current event, which we haven't typed in yet, is event 13. `!11' and
`!-2' refer to event 11. `!!' refers to the previous event, 12. `!!'
can be abbreviated `!' if it is followed by `:' (`:' is described
below). `!n' refers to event 9, which begins with `n'. `!?old?' also
refers to event 12, which contains `old'. Without word designators or
modifiers history references simply expand to the entire event, so we
might type `!cp' to redo the copy command or `!!|more' if the `diff'
output scrolled off the top of the screen.默认的 /bin/csh 只保存 100 条历史命令,并且当你使用同一个账号开启多个连接到同一台服务器的时候,最终保存的历史命令可能只有最后退出那次会话的命令,其他连接中使用的命令没有保存起来。通过设置以下参数可以让 /bin/csh 合并多连接状态的历史命令:
set history = 2000 set savehist = 2000 merge
可以将以上设置保存到 /etc/csh.cshrc 或者 ~/.cshrc。(更多信息请参考“man csh”)



No comments yet