tcsh – keeping your prompt always up to date

In case you want to put some variable’s value inside tcsh prompt you should consider using precmd in order to keep it updated. Inside your ~/.login put following code

alias precmd 'source ~/bin/prompt.sh'

Inside ~/bin/prompt.sh you can put any definition of prompt

set prompt="┌[%n@%m variable=${ENV_VAR}]\n└[%~] "

If you use precmd you will keep the value of ENV_VAR always updated in the prompt.

You may also want to change default “cd” behavior: tcsh + pushd + cd – very convenient settings