Featured post
osx - Best practice for Bash start-up files on a Mac -
as understand it, order start-up files read bash shell on mac are...
- ~/.bash_profile
- ~/.bash_login
- ~/.profile
..and once 1 file in list found, contents of other ignored.
that being said, there best practice of these files should 1 true bash start-up file?
on 1 hand, if .bash_profile take precedence on other potential start-up file, should used, because can sure 100% of time info in start-up file being run.
on other hand, if .profile file exists on mac systems default, , .bash_profile needs manually created, perhaps should used, , there never reason create .bash_profile file.
thoughts?
it depends on whether use shells other bash, , whether use bash-only features in profile. if use other sh-style shells (sh, ksh, zsh, etc not csh or tcsh), don't use bash-only features , want same setup no matter shell you're in, should use .profile. if want use bash-only features, use .bash_profile. if want use multiple shells use bash-only features, put common stuff in .profile , bash-only stuff in .bash_profile, add if [ -f ~/.profile ]; . ~/.profile; fi
.bash_profile.
if ever use bash, don't rely on bash-only features in profile, doesn't matter.
there's complication: login bash shells source either .bash_profile, .bash_login, or .profile; non-login interactive bash shells (e.g. subshells) source .bashrc instead. tend want same setup in both login , non-login shells, put interesting stuff in .bashrc, , if [ -f ~/.bashrc ]; . ~/.bashrc; fi
in .bash_profile. if used other shells, i'd put of in .profile instead, , have .bashrc source instead.
- Get link
- X
- Other Apps
Comments
Post a Comment