Hacker News new | past | comments | ask | show | jobs | submit login

I've been doing Unix for 30 years now and for the last 27 I've had all these scripts wired together. Or rather I have one script, then the others execute it.

I get in theory why I'd want interactive login shells to have a fancier / more complex environment than others. Maybe I should care more about optimizing startup time of non-interactive shells. But really, who has the time to figure that stuff out?




It's simple enough.

Put env vars in bash profile and functions, aliases and other non-env (completion, nvm, rvm etc) in bashrc.

Put the latter into the former and they aren't inherited. Put the former into the latter and path appends and other non-idempotent edits to env vars don't work correctly. Though I personally use some functions to make sure my path edits are idempotent for ease of iteration when editing.


(Oh and you want to source your .bashrc from your .bash_profile so you start out with both env vars and everything else.)


> It's simple enough.

> (Oh and ...)

+1 to just dumping it all in ~/.bashrc


  . ~/git/stuff/bash_common.sh




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

Search: