Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Save and merge tcsh history across windows and sessions UNIX
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
...in .tcshrc and this line...
history -S
...in .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.]
    •    
  • Currently 3.13 / 5
  You rated: 3 / 5 (8 votes cast)
 
[12,133 views]  

Save and merge tcsh history across windows and sessions | 2 comments | Create New Account
Click here to return to the 'Save and merge tcsh history across windows and sessions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Save and merge tcsh history across windows and sessions
Authored by: jochen K├╝pper on Jul 17, '07 01:02:02PM
tcsh nicely does all that by itself, actually...
From the tcsh man page:
Note that login shells do the equivalent of `history -L' on startup and, if savehist is set, `history -S' before exiting.
In Terminal.app the default shell is started via /usr/bin/login and thus is actually a login shell. I have set savehist=(5000 merge) and nothing else fance, always used to work for me;)

[ Reply to This | # ]
Login shells
Authored by: zacht on Jul 17, '07 06:31:05PM

Well, what you say seems right, but some people may have changed their Terminal.app preferences to have new windows run /usr/bin/tcsh (or some other command) instead of the default /usr/bin/login with the shell set to tcsh (via NetInfo or chsh or whatever). Perhaps the hint is more relevant to those people? Just a thought.



[ Reply to This | # ]