user8420047
user8420047

Reputation:

Modifying Individual User $PATH in Fish Shell

I'm trying to change the $PATH of an individual user in fish-shell so that berryconda runs before default python.

I've found my way to the config.fish file and added what the file says to add for login shells.

if status --is-login
set PATH /root/berryconda3/bin/python $PATH
end

My issue is this doesn't seem to change the $PATH at all and I also only want it to occur for one specific user anyway so I don't think this is correct. How can I go about changing the $PATH of an individual user in fish-shell.

Upvotes: 0

Views: 226

Answers (1)

Kurtis Rader
Kurtis Rader

Reputation: 7459

Add the following to the user's ~/.config/fish/config.fish file:

contains /root/berryconda3/bin/python $PATH
or set -gx PATH /root/berryconda3/bin/python $PATH

Using if status is-login to guard the modification is reasonable if you only want it to be done for the first shell launched by a terminal. However, it may never be true if the terminal is configured to launch the shell without marking it a login shell.

Also, that point points to a file in the root acount home dir. That may not be accessible by a non-root user and in any case it is bad idea to have non-root accounts depending on files in the root user home dir.

Upvotes: 3

Related Questions