
透過~/.bashrc
根據需要進行配置,每次使用者登入 bash shell 時,.bashrc
都會自動設定已配置的設定。現在我一定錯過了一些東西,但儘管徹底鴨鴨Go我無法找出相當於C殼。
作為 bash-shell 的參考,該問題對配置其預設設定進行了全面的解釋: .bashrc 檔案是什麼?
作為參考,我使用的是 CentOS:(正如您可能已經猜到的,LINUX 不是我的強項)
[user@computer ~]$ uname -r
2.6.32-504.12.2.el6.x86_64
[user@computer ~]$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
非常感謝您閱讀這篇文章。
-- 編輯 -- 固定標籤。
-- 編輯 2 -- 意味著這也是一個非常好的(相關的)問題: .bashrc 檔案是什麼?
答案1
csh
tcsh
幾乎在所有系統上都有效,包括 CentOS。來自 tcsh 線上說明頁 ( tcsh(1)
):
啟動和關閉
登入 shell 首先執行系統檔案
/etc/csh.cshrc
和/etc/csh.login
.然後,它從使用者主目錄中的檔案執行命令:首先~/.tcshrc
(+) 或,如果~/.tcshrc
未找到,~/.cshrc
則 、then~/.history
(或變數的值histfile shell
)、然後~/.login
、最後~/.cshdirs
(或 dirsfile shell 變數的值)(+ )。如果這樣編譯的話,shell 可以讀取/etc/csh.login
before 而不是 after/etc/csh.cshrc
,以及~/.login
before 而不是 after~/.tcshrc
或~/.cshrc
and~/.history
;請參閱版本 shell 變數。 (+)非登入 shell 只讀
/etc/csh.cshrc
或在啟動時~/.tcshrc
讀取~/.cshrc
。[...其餘部分已修剪...]
我個人喜歡直接使用~/.tcshrc
.如果需要,您可以「偵測」登入 shell,如下所示:
setenv PATH /bin:/sbin/:...
if ( $?prompt ) then
exit
endif
# This is only for interactive shells
set color
set printexitvalue