logoalt Hacker News

thefilmore • today at 6:02 PM • 2 replies • view on HN

You can just do:

  PATH=~/.local/bin:$PATH
PATH is already exported. Quotes are also not necessary for assignments.

Replies

stkdump • today at 6:26 PM

Looks dangerous to put a user writable directory ahead of system directories in PATH

➕ show 1 reply
russellbeattie • today at 6:53 PM

While we're all getting pedantic and esoteric, in zsh you can do this:

path+=(~/.local/bin)

You don't even have to use the "export" keyword. Not that I would do this, but since we're all pointing out random shell stuff...

(In zsh the lowercase "path" variable is an array that's automatically tied to the $PATH string, so you can just add to it using parens to signify new array elements, separated by a space.)