~/.bash_profile -> Don't write anything extra. Write a setting that runs only once at login Write only the settings to read .profile and .bashrc
~/.bashrc Write the settings you want to execute each time you start the shell ex.) EDITOR variable, prompt setting
~/.profile Write something that doesn't depend on bash ex.) Environment variables, GUI settings
.bash_profile
# .Read profile
if [ -f ~/.profile ] ; then
. ~/.profile
fi
# .load bashrc
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
.bashrc
#git branch name and line break
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
# default:cyan / root:red
if [ $UID -eq 0 ]; then
PS1='\[\033[31m\]\[\033[00m\]\[\033[01m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
else
PS1='\[\033[36m\]\[\033[00m\]\[\033[01m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
fi
.profile
#environment variable setting of ruby
export PATH=$HOME/.nodebrew/current/bin:$PATH
eval "$(rbenv init -)"
https://techracho.bpsinc.jp/hachi8833/2019_06_06/66396
Recommended Posts