Guest46 | hi guys, hope everyone's doing well. I'm trying to get ~/.local/bin on my system's PATH | 01:56 |
---|---|---|
gnarface | easy to do | 01:56 |
Guest46 | well I want it to whenever I log in | 01:56 |
phogg | For just one user, or for all users? | 01:57 |
Guest46 | either or] | 01:57 |
Guest46 | it looks like .profile add .local/bin by default | 01:57 |
Guest46 | but for some reason .profile isn't running when bash starts, I don't understand why | 01:58 |
phogg | Guest46: this explains why: PAGER='less +/^INVOCATION' man bash | 01:59 |
gnarface | i've seen some graphical login managers/window environment combinations bypassing .profile | 01:59 |
gnarface | usually you can just get around it by adding it to your startup options | 02:00 |
phogg | tl;dr ~/.profile is only read for *login* shells, and the only if ~/.bash_profile and ~/.bash_login are not present | 02:00 |
Xenguy | There's also ~/.bashrc to consider; one file often references another | 02:00 |
gnarface | yea it's usual for the profile to reference .bashrc | 02:00 |
Xenguy | yep | 02:00 |
gnarface | but the path manipulation i've always seen in the profile | 02:00 |
phogg | Guest46: if you are really in bash you can resolve this by careful setup of ~/.bashrc ~/.bash_profile and ~/.profile -- but if it's some non-shell location you may, as gnarface says, have never used ~/.profile at all | 02:01 |
gnarface | in fact the default stock profile should have a commented-out example entry for adding ~/bin to your PATH | 02:01 |
Guest46 | would it be safe to run .profile from .bashrc then? does .bashrc apply to an interactive shell? | 02:05 |
phogg | If you want your bash env to always be consistent my advice is to have ~/.bash_profile contain one line: source ~/.bashrc; then, in ~/.bashrc start by sourcing ~/.profile, and then have ~/.profile start with a line that sources /etc/profile to match login shell behavior. After that put all remaining shell rc at either the end of ~/.profile or the end of ~/.bashrc | 02:05 |
phogg | this way you get the same results (with some wasted effort) for login and non-login bash shells, and you get as much of it as possible for non-bash shells that only respect profile | 02:05 |
phogg | Guest46: again, the man page reference I linked explains this concisely and completely. Briefly, yes (if by run you mean source) and yes, but not always. | 02:06 |
Guest46 | alright I'll do some more reading. thanks. | 02:08 |
gnarface | Guest46: it's your system so you should make it how you want, but traditionally you'd put stuff in .profile or .bash_profile that you only want in login shells, and you put stuff in .bashrc that you want in both... there's some reasons why they're separate | 03:01 |
gnarface | (it's normal to load .bashrc from .profile but it's not normal to also load .profile from .bashrc) | 03:02 |
gnarface | (nothing will stop you from doing it both ways though, have fun) | 03:03 |
FatPhil | I have a little multiple-sourcing check - they both look for the absense of an environmental variable before doing the source | 10:02 |
FatPhil | I think I prefer phogg's advice of bouncing between bash_profile, bashrc, and profile. Not sure if bashrc should start or end with the sourcing of the profile though. That's a philosophical question. | 10:07 |
clemens3 | rm .profile; echo source ~/.bashrc > .bash_profile | 13:55 |
debdog | FatPhil: no philosophical question there. bashrc is sourced by all shells while profile is supposed to be sourced by login shells. | 14:02 |
debdog | ..only. | 14:02 |
u-amarsh04 | yay, libreoffice 4:7.4.4-8 is installable | 14:45 |
Death_Syn | Hey there! I've got some stale connections showing in the pg_stat_replication view that I'm trying to figure out how to get rid of. Unfortunately, they all share the same application name with one connection that IS working properly. How can I drop these rows that show in state 'startup'? | 15:41 |
Death_Syn | (without breaking the working connection) | 15:41 |
Death_Syn | err | 15:42 |
Death_Syn | wrong channel, apologies | 15:42 |
FatPhil | debdog: yes, but should your .profile run in the context of a properly configured shell - i.e. at the end of your .bashrc, or should .bashrc run in the context of your one-time login-specific .profile settings? Noone's arguing against the statement that you just made. | 19:21 |
debdog | hmm, ok, I think I understand now | 19:28 |
phogg | debdog: Re: bashrc, it is a philosophical question. Should there be login-time shell rc and separate non-login-time shell rc? Should some things happen at both times? Reasonable people can disagree. The reason not to rm ~/.profile is in case you ever want to use sh and have some of your config e.g. PATH be set. | 22:00 |
phogg | Happy to discuss it further in -offtopic if you like. | 22:01 |
Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!