You are not logged in.

#1 2020-09-26 04:02:57

apastuszak
Member
From: Besalem, PA USA
Registered: 2014-10-18
Posts: 168
Website

Add to PATH

I am trying to add $HOME/.local/bin to my path.

I went to this page in the wiki:  https://wiki.archlinux.org/index.php/En … _variables

According to the wiki I should edit .bash_profile.

I added the following line to it: export PATH="${PATH}:${HOME}/.local/bin"

I rebooted, and it didn't work.

I added the same path to ~/.xinitrc and ~/.xsessionsrc and it didn't work in either of those.

I then added it to ~/.pam_environment

Still didn't work.  I am running XFCE4 on x.org

There must be something really stupid I am not doing.

Offline

#2 2020-09-26 06:38:01

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: Add to PATH

Try using ~/.profile and proof "doesn't work":

echo $PATH

In order to have bash_profile interpreted, you must use a bash login shell (eg. logging into bash on the console) and for .xinitrc either startx or xinit or xdm… as you see, the actual login process matters, so how do you? (lightdm, lxdm,… ?)

Also post the actual files, eg. a regular mistake would be this stanza

…
exec openbox
export PATH="${PATH}:${HOME}/.local/bin"

which will not work, because "exec" replaces the shell process w/ openbox and the rest of the shell script (the export) isn't executed.

Offline

#3 2020-09-26 13:03:43

apastuszak
Member
From: Besalem, PA USA
Registered: 2014-10-18
Posts: 168
Website

Re: Add to PATH

Here is my .bash_profile

[[ -f ~/.bashrc ]] && . ~/.bashrc
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

export PATH="${PATH}:/home/andy/.local/bin"

alias t="todo.sh"

The alias command does work.

I am using LightDM to login.

Offline

#4 2020-09-26 13:06:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: Add to PATH

And what is in your bashrc? (most importantly, if the 't' alias is also defined there, the fact that it "works" is not a useful diagnostic).

Last edited by Trilby (2020-09-26 13:06:39)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2020-09-26 16:42:38

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: Add to PATH

Overmore, what's the output of "echo $PATH" (the PATH will not be available outside a bash, notably not in your desktop environment other than a TE running a bash)
That being said: "echo $SHELL" might also be relevant…

Offline

#6 2020-09-26 16:44:42

apastuszak
Member
From: Besalem, PA USA
Registered: 2014-10-18
Posts: 168
Website

Re: Add to PATH

Adding it to .profile worked.

Here is my .bashrc

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

if [ -e $HOME/.bash_aliases ]; then
    source $HOME/.bash_aliases
fi

EDIT: I do have a .bash_aliases file.  I assume that's my issue.  It's using .bash_aliases instead of .bash_profile?

Last edited by apastuszak (2020-09-26 16:47:15)

Offline

#7 2020-09-26 16:58:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: Add to PATH

No, bash loads .bash_profile on login, that in turn reads your .bashrc - and your bashrc reads .bash_aliases.

But none of these are loaded by xinit/startx or display managers.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2020-09-26 20:37:52

apastuszak
Member
From: Besalem, PA USA
Registered: 2014-10-18
Posts: 168
Website

Re: Add to PATH

But they should load when I run xfce terminal, should they not?  That didn't seem to be happening.

Offline

#9 2020-09-26 20:42:28

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: Add to PATH

should … seem

Again…

echo $SHELL $PATH

But no, because

seth wrote:

In order to have bash_profile interpreted, you must use a bash login shell (eg. logging into bash on the console)

and the shell inside the VTE on a desktop session is not a login shell - you're already logged in at that point.
The bashrc would be interpreted there.

Offline

#10 2020-09-27 15:26:39

apastuszak
Member
From: Besalem, PA USA
Registered: 2014-10-18
Posts: 168
Website

Re: Add to PATH

So, I have to assume that the Arch Wiki is written with the assumption that you're logging into the machine from bash and not from a GUI.  I followed the instructions in the wiki and it said to add the command to my .xinitrc.  I did that and it did not work.  So, I have to assume that .xinitrc is only read if you login via bash and then type startx.

Offline

#11 2020-09-27 15:41:59

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,769
Website

Re: Add to PATH

apastuszak wrote:

I followed the instructions in the wiki

No, you didn't: https://wiki.archlinux.org/index.php/Li … _variables

Offline

#12 2020-09-27 17:22:23

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: Add to PATH

Also you don't have to login w/ bash to get xinitrc read - only run something that sources it (xinit, startx, xdm and possbily other stuff)
Read teh wiki again. And read more carefully.

Offline

Board footer

Powered by FluxBB