在 DOS 中有兩個很重要的檔案 -- AUTOEXEC.BAT 和 CONFIG.SYS. 當啟動 DOS 時,
這兩個檔案負責一些系統的設定工作 , 諸如設定環境變數 PATH, FILES 等等, 甚至
呼叫其它必需在開機時載入的程式.
在 linux 中也有一些類似工作的檔案, 但其中有些卻是相當的危險; 再你真正了解
你將要做的事之前, 請千萬別去碰它. 無論如何, 我還是得告訴你那些需要非凡謹慎
的檔案:
FILES NOTES
/etc/inittab don't toUCh for now!
/etc/rc.d/* ditto
假如你想做的是設定 PATH 或是其它的環境變數, 抑或修改 login 時的訊息, 呼叫一個
程式, 以下大概就是你要的:
FILES NOTES
/etc/issue sets PRe-login message 設定 login 前的訊息
/etc/motd sets post-login message 設定 login 後的訊習
/etc/profile sets PATH and other variables, etc. 設定環境變數
/home/your_home/.profile does whatever you want 這里可以隨意加入你想要的
假如最後那一個檔案(~/.profile) 存在, (注重到它是隱藏檔), 那麼在你 login 之後
它的內含命令就會被執行.
范例 - 請看這個 .profile:
# I am a comment
echo Environment:
printenv more # equivalent of command SET under DOS
alias d='ls -l' # easy to understand what an alias is
alias up='cd ..'
echo "I remind you that the path is "$PATH
echo "Have a good day, "$LOGNAME
PATH 和 LOGNAME, 正如你所預料的, 是兩個環境變數.