Как мы можем настроить пути для .cshrc

798
SAN

В сценарии оболочки я пытаюсь открыть новую оболочку tcsh и загрузить некоторый набор предопределенных псевдонимов и переменных env, которые я не хочу иметь в cshrc по умолчанию. Я не могу иметь его в своем домашнем каталоге, так как этот сценарий будет использоваться несколькими пользователями. По каким путям tcsh будет искать файл cshrc при создании нового xterm или оболочки? Это настраивается через некоторую переменную env?

1

1 ответ на вопрос

1
Martin Tournoij

From the manpage:

A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the value of the dirsfile shell variable) (+). The shell may read /etc/csh.login before instead of after /etc/csh.cshrc, and ~/.login before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see the version shell variable. (+)

There is no argument of environment variable to change this, except for -f to prevent loading a startup file.

You can use the source command to load a file from within tcsh, though:

source /etc/my-special-settings.tcsh 

You could also do something like this in your user's ~/.tcshrc:

if ( $?SPECIAL_SETTINGS ) then source /etc/my-special-settings.tcsh else source ~/.tcsh/tcshrc endif 
Спасибо @Carpetsmoker, я действительно использую переменную env. Я не хотел просить всех пользователей добавить это в их .cshrc. SAN 9 лет назад 0

Похожие вопросы