You are not logged in.

#1 2017-01-11 03:58:43

horo
Member
Registered: 2016-03-13
Posts: 78

How do I permanately update $PATH?

I recently installed Rust using their install script, which made .cargo/bin in my home folder to store the various commands.
The install scripted amended my ~/.profile file with

export PATH="$HOME/.cargo/bin:$PATH"

However opening a new instance of the terminal does not update the $PATH and I must export the directory again for me to run commands.

I attempted to add a new entry into ~/.profile to corrected this when I saw the commented out section that .profile is only used if .bash_profile or .bash_login is not detected.

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
#
# Modified version provided by bunsen-configs.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# include sbin in PATH
if [ -d "/sbin" ] ; then
    PATH="/sbin:$PATH"
fi
if [ -d "/usr/sbin" ] ; then
    PATH="/usr/sbin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.cargo/bin" ] ; then
    PATH="$HOME/.cargo/bin:$PATH"
fi

export PATH="$HOME/.cargo/bin:$PATH"

Again this did not alter the $PATH variable. i then ran-

horo@debian:~$ sudo updatedb
[sudo] password for horo: 
horo@debian:~$ locate .bash*
/etc/bash.bashrc
/etc/skel/.bash_logout
/etc/skel/.bashrc
/home/horo/.bash_aliases
/home/horo/.bash_history
/home/horo/.bash_logout
/home/horo/.bashrc
/usr/share/base-files/dot.bashrc
/usr/share/bunsen/skel/.bash_aliases
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bash_logout
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc
horo@debian:~$ 

and noted no files marked .bash_profile or .bash_login
I tried

$ cp .profile .bash_profile

But this made no difference

I've read I can update $PATH by altering .bashrc, but this is intended for script use.

So how can I alter my $PATH with out exporting everytime I start the terminal.

Offline

#2 2017-01-11 05:34:41

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: How do I permanately update $PATH?

have you actually logged out / in?
also a simple

ls -al ~

would have been preferable over locate in this case.

but i think i remember that bunsenlab's login manager does not execute either at login :-(

i take it you tested with

echo $PATH

?

have you tried placing the line of code in ~/.config/openbox/autostart? not sure it'll work though.

Offline

#3 2017-01-11 07:27:42

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: How do I permanately update $PATH?

Add it to ~/.xsessionrc

https://github.com/BunsenLabs/bunsen-co … sionrc#L21

That file is parsed by display managers wink

Offline

Board footer

Powered by FluxBB