Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Environment variables are automatically shared from a parent process to its child processes, so typically you'd want to set up your environment in ~/.profile (or ~/.bash_profile) so you only have to do the work once. This includes things like setting $PATH, $LESS, $EDITOR, $LS_COLORS and so forth.

On the other hand, things like shell aliases are not automatically shared to child processes, so you need to set them up afresh in every shell you launch. Therefore, ~/.bashrc is the place for those things.



> typically you'd want to set up your environment in ~/.profile (or ~/.bash_profile)

It's an early optimization, that generally no longer is worth the complexity. I put everything in .bashrc. I'm more likely to break out a separate environment shell file by related or complex tasks to assist in testing/debugging my environment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: