1

I am executing a command in TCSH, which requires me to pass a password on the command line. Obviously, I would like it not to be saved in the history file.

I know that other shells like Bash supports various ways to achieve it, like export HISTCONTROL=ignorespace.

Is there anything similar for TCSH (preferably on FreeBSD)?

2

TCSH does not support anything like this. The whole history of a shell session is merged to the history file when the shell is closed.

It is possible to skip a command from being added to the history file, however, by spawning another TCSH shell and unsetting savehist:

root@freebsd:~ # csh
root@freebsd:~ # echo First shell: $$
First shell: 7143
root@freebsd:~ # exit
root@freebsd:~ # tail -n 1 ~/.history
echo First shell: $$
root@freebsd:~ # csh
root@freebsd:~ # unset savehist
root@freebsd:~ # echo Second shell: $$
Second shell: 74821
root@freebsd:~ # exit
root@freebsd:~ # tail -n 1 ~/.history
echo First shell: $$

As you can see, the command of the second shell were not appended to the history file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.