Skip to main content
39 events
when toggle format what by license comment
Jan 7 at 14:31 comment added V. Bozz Why not "$PATH" in double quotes? Should be safer, I guess
Jul 28, 2023 at 19:23 comment added aioobe Note that a fresh Ubuntu installation does not read .profile any more.
Nov 23, 2022 at 20:40 comment added Gilles 'SO- stop being evil' @Dzintars No shell has a rule to read /etc/profile. Many systems set up /etc/profile to read /etc/profile.d/*. If so you'll see the code to do that in /etc/profile.d.
Nov 23, 2022 at 19:50 comment added Dzintars No single word about /etc/profile.d/somefile.sh which also could contain PATH segments. It is used quite a lot in automation because dropping entire file is simpler than dealing with specific lines in general files like .profile.
Sep 26, 2022 at 11:01 comment added Gilles 'SO- stop being evil' @sancho.sReinstateMonicaCellio That answer didn't exist when I posted mine. I also don't agree that it “clearly explains” the problem: it spends a lot of time explaining the solution before mentioning the reason in passing (and it doesn't even actually state what an empty path component means). The solution in that answer is also rather complex and usually not really relevant: when PATH is empty, you typically don't need to add one extra directory to it, but to populate it with some standard directories. So I show how to do this.
Sep 26, 2022 at 10:34 comment added sancho.s ReinstateMonicaCellio @Gilles'SO-stopbeingevil' - Out of curiosity: why not linking to an existing answer in section "Potential complications in some system scripts", which clearly explains the case, and what to do about it? That would likely help readers (one of the main missions of SE), at least knowing better the pros and cons of using one form or another, and deciding based on that.
Sep 7, 2022 at 17:33 comment added Gilles 'SO- stop being evil' @BenCarp .zshrc only works for programs started via a terminal. .zprofile applies to all programs. (Except on macOS which does things differently and AFAIK doesn't have a way to run shell code to set environment variables.)
Sep 7, 2022 at 16:20 comment added Ben Carp Does it matter if we put it in .zshrc or zprofile?
S Sep 4, 2022 at 20:40 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
original advice about .profile was incorrect for macOS. Also, mention that these are only called at login.
S Sep 4, 2022 at 20:40 history suggested xdavidliu CC BY-SA 4.0
original advice about .profile was incorrect for macOS. Also, mention that these are only called at login.
Sep 4, 2022 at 19:27 review Suggested edits
S Sep 4, 2022 at 20:40
Mar 18, 2022 at 16:15 comment added iconoclast @TomRussell: you shouldn't be setting your environment variables in .bashrc, since that is specifically for interactive shells and you want your variables available to non-interactive shells too.
Feb 18, 2021 at 10:59 comment added sancho.s ReinstateMonicaCellio As detailed here, this basic form of adding to path should likely be replaced by a more robust version.
Feb 18, 2021 at 2:35 comment added Tom Russell What about when the element being added to $PATH is an environment variable set inside ~/.bashrc?
Feb 28, 2020 at 13:10 history rollback Paulo Tomé
Rollback to Revision 14
S Feb 28, 2020 at 13:07 history suggested Black CC BY-SA 4.0
added NOTE
Feb 28, 2020 at 12:31 review Suggested edits
S Feb 28, 2020 at 13:07
Feb 22, 2020 at 20:43 review Suggested edits
Feb 22, 2020 at 22:51
Dec 4, 2019 at 11:50 comment added therobyouknow could it also be export PATH ...
Jul 30, 2019 at 10:32 comment added icc97 Thank you for this answer, perfectly detailed. You say "You should not define environment variables in ~/.bashrc", but unfortunately 100% of the programs that I have installed on my system that modify the path (FZF and Rust's Cargo) modify the path in .bashrc. I assume because FZF is written in Rust too it's following the pattern of Rust.
Jul 12, 2019 at 8:30 comment added Gilles 'SO- stop being evil' @priojeetpriyom Simple explanation: you don't need export.
Jul 12, 2019 at 5:49 comment added priojeet priyom Still not able to understand the complication with export. can you please simplify it?
Jun 15, 2019 at 8:47 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
deleted 14 characters in body
S Jun 15, 2019 at 8:45 history suggested Gabriel Staples CC BY-SA 4.0
minor formatting and wording to clarify you only need 1 path command, and to make the correct file to place this in stand out
Jun 14, 2019 at 23:21 review Suggested edits
S Jun 15, 2019 at 8:45
S May 4, 2019 at 23:16 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
Fix syntax and grammar
S May 4, 2019 at 23:16 history suggested maf88 CC BY-SA 4.0
Fix syntax and grammar
May 4, 2019 at 23:02 review Suggested edits
S May 4, 2019 at 23:16
Oct 24, 2018 at 18:07 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
add a note about /etc/environment since a reader didn't realize that this wasn't a shell script
Oct 23, 2018 at 18:47 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
note that some systems already have ~/bin as suggested by patryk.beza
Oct 23, 2018 at 18:38 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
Add an explicit note not to add `export` to the first section; move the bit about why you don't need it to a separate section because that's not "simple stuff"; use overstrike for the bad example; add a discussion of an initially empty PATH as suggested by James Tocknell
Nov 2, 2017 at 7:10 history edited Stéphane Chazelas CC BY-SA 3.0
added 187 characters in body
Apr 13, 2017 at 12:36 history edited CommunityBot
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Mar 20, 2017 at 10:18 history edited CommunityBot
replaced http://superuser.com/ with https://superuser.com/
Jun 25, 2014 at 8:25 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
reorganize the answer to separate out the non-bash stuff; cite some other threads about duplicate removal, which is good to mention here; note that `export var=~` is expanded in bash (thanks mikeserv)
Jun 23, 2014 at 1:10 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
mention the necessity of double quotes in some shells
Feb 19, 2014 at 23:47 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
mention the relevance of the order, since it came up in http://unix.stackexchange.com/questions/115964/program-installed-to-home-username-bin-and-added-to-path-not-launching
Oct 2, 2012 at 0:00 vote accept Paolo
Dec 4, 2011 at 23:39 history answered Gilles 'SO- stop being evil' CC BY-SA 3.0