每次啟動新 shell,bash shell 都會運(yùn)行.bashrc 文件。①對此進(jìn)行驗(yàn)證,可以使用這種方法:在
主目錄下的.bashrc 文件中加入一條簡單的 echo 語句,然后啟動一個(gè)新 shell。文章來源:http://www.zghlxwxcb.cn/news/detail-745295.html
$ cat $HOME/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
export PATH
# Uncomment the following line if you don't like systemctl's autopaging feature:
# export SYSTEMD_PAGER=?
# User specific aliases and functions?
echo "I'm in a new shell!"?
$?
$ bash?
I'm' in a new shell!?
$?
$ exit?
exit?
$?
.bashrc 文件通常也借由某個(gè) bash 啟動文件來運(yùn)行,因?yàn)?bashrc 文件會運(yùn)行兩次:一次是當(dāng)
用戶登錄 bash shell 時(shí),另一次是當(dāng)用戶啟動 bash shell 時(shí)。如果需要某個(gè)腳本在兩個(gè)時(shí)刻都運(yùn)行,
可以將其放入該文件中。文章來源地址http://www.zghlxwxcb.cn/news/detail-745295.html
到了這里,關(guān)于shell_73.Linux使用新 shell 啟動腳本的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!