You are not logged in.

#1 2021-08-03 07:01:12

gustavosb
Member
Registered: 2013-06-16
Posts: 13

[SOLVED] $HOME/.local/bin in Path but not Working

I am setting $HOME/.local/bin to be in PATH with append_path, both in /etc/profile, and .profile

Here is the output of

  % echo $PATH
  /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:$HOME/.local/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Clearly $HOME/.local/bin is in the path, however, if I

  % touch .local/bin/pathtest
  % chmod +x .local/bin/pathtest
  % pathtest

I get

  zsh: command not found: pathtest

What am I doing wrong? Is it because $HOME is not in quotes or something? Should it have expanded to my actual home?

Last edited by gustavosb (2021-08-03 10:28:59)

Offline

#2 2021-08-03 07:13:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] $HOME/.local/bin in Path but not Working

1. Zsh doesn't read ~/.profile: https://wiki.archlinux.org/title/Zsh#St … down_files

2. Paste the contents of the file where the PATH is declared. And the contents of any zshrc, zshenv or zprofile files that you have.

3. How do you login?

4. If you are using OMZ, don't bother with 2 or 3.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2021-08-03 07:37:36

gustavosb
Member
Registered: 2013-06-16
Posts: 13

Re: [SOLVED] $HOME/.local/bin in Path but not Working

jasonwryan wrote:

1. Zsh doesn't read ~/.profile: https://wiki.archlinux.org/title/Zsh#St … down_files

2. Paste the contents of the file where the PATH is declared. And the contents of any zshrc, zshenv or zprofile files that you have.

3. How do you login?

4. If you are using OMZ, don't bother with 2 or 3.

1. But it does read /etc/profile

2. ~/.profile is just append_path '$HOME/.local/bin' and /etc/profile is

# /etc/profile

# Set our umask
umask 022

# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

# Append our default paths
append_path '/usr/local/sbin'
append_path '/usr/local/bin'
append_path '$HOME/.local/bin'

# Force PATH to be environment
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
	for profile in /etc/profile.d/*.sh; do
		test -r "$profile" && . "$profile"
	done
	unset profile
fi

# Unload our profile API functions
unset -f append_path

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
   test "$PS1" &&\
   test -z "$POSIXLY_CORRECT" &&\
   test "${0#-}" != sh &&\
   test -r /etc/bash.bashrc
then
	. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

~/.zshrc is

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=100000
setopt appendhistory beep nomatch notify
unsetopt autocd extendedglob
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/gustavo/.zshrc'

autoload -Uz compinit promptinit
compinit
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'

# End of lines added by compinstall
promptinit
RPROMPT='%(?..[%?%1v] )%F{red}[%F{cyan}%D{%a %d/%m %R}%F{red}]'
PROMPT='%F{red}<%F{green}%n@%m%F{white}:%F{yellow}%~%F{red}>
%f%B%#%b '

autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

typeset -g -A key
autoload zkbd
source ~/.zkbd/$TERM-${${DISPLAY:t}:-$VENDOR-$OSTYPE}

[[ -n "${key[Up]}"   ]] && bindkey -- "${key[Up]}"   up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search

CASE_SENSITIVE="true"

and I don't have any more places where I set path from, AFAIK

3. I log in with lightdm

4. I don't use OMZ

My point is, it says in the path that $HOME/.local/bin is there, but it does not work

Last edited by gustavosb (2021-08-03 10:22:40)

Offline

#4 2021-08-03 07:45:55

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,375

Re: [SOLVED] $HOME/.local/bin in Path but not Working

etc/profile is read by login shells, try

zsh -l

You'll probably pick it up globally w/ a re-login, in doubt restart lightdm.

Also please edit your post and wrap the file contents in code tags, https://bbs.archlinux.org/help.php#bbcode

Offline

#5 2021-08-03 07:48:14

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] $HOME/.local/bin in Path but not Working

Please edit your post and use code tags: https://wiki.archlinux.org/title/Genera … s_and_code

Also, please read the wiki on setting the Zsh path: https://wiki.archlinux.org/title/Zsh#Configuring_$PATH


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2021-08-03 07:55:29

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,678
Website

Re: [SOLVED] $HOME/.local/bin in Path but not Working

Single quotes do not expand variables in most shells.
You need to add "${HOME}/foo/bar" instead of '${HOME}/foo/bar' to the path.
Otherwise the shell will think, that you want that literal path and not the path to the respective home directory.


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#7 2021-08-03 10:23:34

gustavosb
Member
Registered: 2013-06-16
Posts: 13

Re: [SOLVED] $HOME/.local/bin in Path but not Working

schard wrote:

Single quotes do not expand variables in most shells.
You need to add "${HOME}/foo/bar" instead of '${HOME}/foo/bar' to the path.
Otherwise the shell will think, that you want that literal path and not the path to the respective home directory.

Thank you schard, this is what I needed.

Offline

Board footer

Powered by FluxBB