Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update $PATH

I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).

I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gnome-terminal).

Where do you suggest to "inject" that $PATH dependecy ? .bashrc, /etc/profile.d, etc. ? What advantages / disadvantages I might encounter ?

For example if i add a script to export the new path in /etc/profile.d, the path is not being updated until I re-login.

Thanks

like image 613
Andrei Ciobanu Avatar asked Aug 09 '26 06:08

Andrei Ciobanu


1 Answers

.profile would be a reasonable place if it's a per-user install; /etc/profile.d for system-wide installs. (You'll need root to do that, of course.)

Your installer won't be able to change the path of the current shell (unless it's being run via source, which would be...odd.)

like image 189
ngroot Avatar answered Aug 12 '26 03:08

ngroot