Save and merge tcsh history across windows and sessions

Jul 17, '07 07:30:07AM

Contributed by: juanfal

After reading a lot of things about the issue of non-saving history files after session closing in tcsh (my favourite shell, especially for its completion flexibility), I founded that putting these lines...

set history = 2000          # History remembered is 2000
set savehist = (2000 merge) # Save and merge with existing saved 
set histfile = ~/.tcsh_history .tcshrc and this line...
history -S .logout solved the problem. Now history is not only preserved between Terminal sessions, but also merged (considering command dates). Also, it is not necessary to issue an exit command, but with a normal window close, the current history is merged.

[robg adds: This older hint covered savehist, but it seems you still had to use exit to get everything to work. The above solution should also work if you simply close a Terminal window.]

Comments (2)

Mac OS X Hints