Tcsh command history

1

I use tcsh and have the following in my .cshrc file. But the .history file is not updated as and when I execute a command. Is there anyway so that .history file is updated every time I execute a command ?

set history=500
set savehist=1
set histfile = ~/.history

Jean

Posted 2013-05-29T19:09:50.523

Reputation: 287

Answers

2

You can manually update the file with history -S

In tcsh, you can make an alias that runs when each command is actually executed:

alias precmd 'history -S'

Kent

Posted 2013-05-29T19:09:50.523

Reputation: 1 354

0

To have the history preserved between multiple simultaneous sessions, you also want to merge the histories:

alias precmd 'history -S; history -M'

Also - you don't want savehist set to 1 - that will only save one line of history. Instead use:

set savehist (500 merge)

to save 500 lines of history

Randall

Posted 2013-05-29T19:09:50.523

Reputation: 205