2

I am trying to get the following behavior for my prompt in TCSH:

/users/james/ $ cd /projects/android/new_project/1.0/
New Project {1.0} / $ cd vars
New Project {1.0} /vars/ $

I have looked at using cwdcmd but I believe that the variable I assign to store the cwd will only be passed to the prompt once. I've also looked at using set prompt='%c3' etc but this only shows the trailing n dirs, not eliminating the initial ones. Before anyone suggests I change shell I have to use TCSH.

Thanks!

4

1 回答 1

2

对于 tcsh 我正在使用以下内容:

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

在脚本里面我可以做任何我喜欢的事情

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

这样,您的提示始终是最新的。更重要的是,您可以根据您所在的位置和设置的变量轻松创建条件提示。

您可以在这里找到更多“小工具”:http ://www.owsiak.org/?s=tcsh

于 2017-06-02T10:45:33.830 回答