Skip to main content
deleted 40 characters in body
Source Link
berong91
  • 71
  • 1
  • 3

In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).

enter image description here

A better way would be save and merge current shell history beforeafter running a command, and save after a comment.

You can achieve it by this setup below instead, becausesince the tcsh doesn't recognize SIGINT or EOF as a valid command.

alias precmd postcmd       "history -M"
alias postcmd      S; "historyhistory -S"M"

In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).

enter image description here

A better way would be save and merge current shell history before running a command, and save after a comment.

You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.

alias precmd        "history -M"
alias postcmd       "history -S"

In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).

enter image description here

A better way would be save and merge current shell history after running a command.

You can achieve it by this setup below instead, since the tcsh doesn't recognize SIGINT or EOF as a valid command.

alias postcmd       "history -S; history -M"
Source Link
berong91
  • 71
  • 1
  • 3

In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).

enter image description here

A better way would be save and merge current shell history before running a command, and save after a comment.

You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.

alias precmd        "history -M"
alias postcmd       "history -S"