Linux環境設定/.bashrcと.bash_profileの違い
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* .bashrcと.bash_profileの違い [#fad70880]
Linuxの標準シェルとして採用されているbash(Bourne Again Sh...
-.bash_profile
-.bashrc
この2つの違い(使い方)について、以下に記述します。
#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)
* 関連記事 [#z70ee4b5]
-[[bashで前回入力したキーワードを置換し再実行する方法>逆...
-[[bashシェルでTABキーを押してホスト名の補完する>逆引きUN...
* .bashrcと.bash_profileの説明 [#eb4c04c1]
|.bashrc|bashを起動するたびに実行されます|
|.bash_profile|ログイン時に一度実行されます|
** 実験 [#f92de640]
CentOSでは以下のように.bashrc, .bash_profileが記述されて...
*** .bashrc [#bbd104ac]
# .bashrc
# Source global definitions~
if [ -f /etc/bashrc ]; then~
. /etc/ba...
fi~
# User specific aliases and functions
*** .bash_profile [#e4351b54]
# .bash_profile
# Get the aliases and functions~
if [ -f ~/.bashrc ]; then~
. ~/.bash...
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
以下のように編集してテストしてみます。
*** .bashrc編集版 [#b065a38d]
読み込まれた時、''Read .bashrc''と表示します。
# .bashrc~
&color(red){echo "Read .bashrc"};~
# Source global definitions~
if [ -f /etc/bashrc ]; then~
. /etc/ba...
fi~
# User specific aliases and functions
*** .bash_profile編集版 [#ga6530bc]
読み込まれた時、''Read .bash_profile''と表示します。~
また環境変数TESTを設定してあります。
# .bash_profile~
&color(red){echo "Read .bash_profile"};~
# Get the aliases and functions~
if [ -f ~/.bashrc ]; then~
. ~/.bash...
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin~
&color(red){export TEST=sakura};~
export PATH
+GUIのログイン後、ターミナルを起動した場合~
Read .bash_profileと出力されていませんが、GUIによるログイ...
#ref(bash-profile-01.gif)
#br
+ターミナルアイコンをクリックして起動した場合~
Read .bashrcのみが表示されます。つまり、.bash_profileは読...
#ref(bash-profile-02.gif)
#br
+sshにて接続しログインしてみる~
Read .bash_profile, Read .bashrcの両方が表示されます。~
つまり、ログイン時は.bash_profileが読み込まれていることが...
.bash_profileの以下の構文により.bashrcが読み込まれ反映さ...
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#ref(bash-profile-03.gif)
#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
#br
終了行:
#navi(../)
* .bashrcと.bash_profileの違い [#fad70880]
Linuxの標準シェルとして採用されているbash(Bourne Again Sh...
-.bash_profile
-.bashrc
この2つの違い(使い方)について、以下に記述します。
#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)
* 関連記事 [#z70ee4b5]
-[[bashで前回入力したキーワードを置換し再実行する方法>逆...
-[[bashシェルでTABキーを押してホスト名の補完する>逆引きUN...
* .bashrcと.bash_profileの説明 [#eb4c04c1]
|.bashrc|bashを起動するたびに実行されます|
|.bash_profile|ログイン時に一度実行されます|
** 実験 [#f92de640]
CentOSでは以下のように.bashrc, .bash_profileが記述されて...
*** .bashrc [#bbd104ac]
# .bashrc
# Source global definitions~
if [ -f /etc/bashrc ]; then~
. /etc/ba...
fi~
# User specific aliases and functions
*** .bash_profile [#e4351b54]
# .bash_profile
# Get the aliases and functions~
if [ -f ~/.bashrc ]; then~
. ~/.bash...
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
以下のように編集してテストしてみます。
*** .bashrc編集版 [#b065a38d]
読み込まれた時、''Read .bashrc''と表示します。
# .bashrc~
&color(red){echo "Read .bashrc"};~
# Source global definitions~
if [ -f /etc/bashrc ]; then~
. /etc/ba...
fi~
# User specific aliases and functions
*** .bash_profile編集版 [#ga6530bc]
読み込まれた時、''Read .bash_profile''と表示します。~
また環境変数TESTを設定してあります。
# .bash_profile~
&color(red){echo "Read .bash_profile"};~
# Get the aliases and functions~
if [ -f ~/.bashrc ]; then~
. ~/.bash...
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin~
&color(red){export TEST=sakura};~
export PATH
+GUIのログイン後、ターミナルを起動した場合~
Read .bash_profileと出力されていませんが、GUIによるログイ...
#ref(bash-profile-01.gif)
#br
+ターミナルアイコンをクリックして起動した場合~
Read .bashrcのみが表示されます。つまり、.bash_profileは読...
#ref(bash-profile-02.gif)
#br
+sshにて接続しログインしてみる~
Read .bash_profile, Read .bashrcの両方が表示されます。~
つまり、ログイン時は.bash_profileが読み込まれていることが...
.bash_profileの以下の構文により.bashrcが読み込まれ反映さ...
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#ref(bash-profile-03.gif)
#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
#br
ページ名: