5 ms·
If I do a survey of 10 engineers who use Linux, and OS X every day - I'm willing to wager that 9/10 of them wouldn't be able to explain what should be in .bash_
by ghshephard 14y ago
If I do a survey of 10 engineers who use Linux, and OS X every day - I'm willing to wager that 9/10 of them wouldn't be able to explain what should be in .bash_profile, .profile, and .bashrc. And I can almost guarantee you they couldn't explain the difference between OS X and Linux.
I know I couldn't. I like the solution, actually:
- .bashrc_all - always gets executed
- .bashrc_scripts - non-interactive bash execution
- .bashrc_interactive - duh.
- .bashrc_login - motd and friends (when you "login")
I'd have no problem remembering that. Why don't you think there is a problem, and, why do you believe this is a poor solution to that (nonexistent) problem?
- smegel 14y agoI think most engineers can hack their way to .bashrc even if they don't know the exact differences between those files. And those that can't probably don't need to or can get someone to help them. I just don't see a huge problem out there that needs to be solved. Why don't i like the solution? Well it breaks a well known standard which will confuse others: show me your bash_profile and bashrc...wait what they are the same?? Secondly it invokes the terror of symlinks and the spaghetti mess that often results. Sort of a nice idea in theory but i would not do it in practice.
- cswetenham 14y agoAm I correct in thinking that instead of symlinking .bashrc, etc. to new_bashrc.sh, you could simply have them 'source new_bashrc.sh'? This would also mean you could keep all your dotfiles in a git repository without worrying about the symlinks.
- nodata 14y agoYou would never need to know the difference - because you can always read the man page.
- azylman 14y agoJust because I "can" do something doesn't mean I "want" to do something or that it's the best way to use my time. That's like saying that we don't need expressive function names in code because we can just refer to the documentation.
- slyall 14y ago$ man bash | wc 5375 41026 312785 "From the Earth to the Moon" by Jules Verne has 39,985 words
- reidrac 14y agoYou don't need to read the whole manual. It's hard when you're looking for something very specific, but in this case it's just the FILES section, so I'll try man bash and then /^FILES. It's like saying /etc/services has 11033 lines in it. Well, use grep or search in the document.
- moe 14y agoWhich man-page exactly? The fun part about .bashrc, .bash_profile, .profile, /etc/bash*, /etc/profile etc. is that their semantics vary wildly between linux-distros. Not even Ubuntu and Debian agree here. You never quite know where, when and if .bashrc is sourced by the distro-templates. A .bash_profile that unconditionally sources .bashrc will work fine on one distro, on the next you will see it run multiple times, on yet another you run into an infinite recursion. His approach is the correct one and you'll find a similar script in just about any sizable, heterogenous deployment.
- nodata 14y agoman bash The INVOCATION part. You find this part by searching for the word "profile".
- digisign 14y agoMasochistic geeks are a dime a dozen. Once they've memorized an unintuitive design, there "is no problem."