You are not logged in.

#1 2023-10-14 13:49:09

b42
Member
Registered: 2023-07-20
Posts: 195

[SOLVED].zprofile does not export custom $PATH

I have this line in my .zprofile file

export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"

but when I type echo $PATH I cannot see /.local/bin in my $PATH

Why?

Last edited by b42 (2023-10-16 14:06:57)

Offline

#2 2023-10-14 14:23:01

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

Re: [SOLVED].zprofile does not export custom $PATH

.zprofile is only sourced by your zsh login shell, if you don't run it as login shell (eg. b/c you're usign some DM) it's inert.
In what context do you want the extended PATH? Interactive shells? => ~/.zshrc

Offline

#3 2023-10-14 14:37:28

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

zsh is my default shell.

what do you mean by login shell?

a prompt to log in with a user?

Offline

#4 2023-10-14 14:56:06

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

Re: [SOLVED].zprofile does not export custom $PATH

https://man.archlinux.org/man/extra/zsh/zshall.1.en but agetty will typilcally get you a loginshell
Running a TE (eg. konsole) in a DE (eg. plasma) will *not*.
Whether or not zsh is your default shell is irrelevant.

Offline

#5 2023-10-14 15:07:52

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

here is my full .zprofile file:

http://0x0.st/H4gU.sh

Offline

#6 2023-10-14 15:12:35

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

Re: [SOLVED].zprofile does not export custom $PATH

Who cares.
Unless you're using zsh as login shell it's a completely inert file, use the zshrc if you want to extend the path for your user only and only in interactive zshells

If you want to see whether it's sourced "export FOO=BAR" so you can check for "echo $FOO"

Offline

#7 2023-10-14 16:09:22

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

echo $FOO returns nothing

Offline

#8 2023-10-14 16:37:38

loqs
Member
Registered: 2014-03-06
Posts: 18,865

Re: [SOLVED].zprofile does not export custom $PATH

b42 wrote:

echo $FOO returns nothing

Then you agree ~/.zprofile is not being sourced for your use case?  Why not follow seth's advice to move the entry to ~/.zshrc?  See also Zsh#Startup/Shutdown_files.

Offline

#9 2023-10-15 09:28:28

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

I want to keep my zshrc as clean as possible. that is why I have zprofile file for env variables. How do I source it?

Offline

#10 2023-10-15 12:47:02

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

Re: [SOLVED].zprofile does not export custom $PATH

You don't. You'd use zsh as login shell but that's apparently (you've failed to comment on that at all) not the case.

If you want those exports only in zsh, you can use ~/.zshenv (maybe read the linked manpage…) - otherwise you put it into the proper location for the relevant context, https://wiki.archlinux.org/title/Environment_variables

Offline

#11 2023-10-15 12:56:47

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

how do I make zsh my login shell?

Offline

#12 2023-10-15 13:01:50

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

Re: [SOLVED].zprofile does not export custom $PATH

By running it as login shell…
This is cyclic. How do you login/start your session to begin with?

Offline

#13 2023-10-15 14:37:27

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

I log in via default Arch Linux terminal to my user

Offline

#14 2023-10-15 15:12:06

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

Re: [SOLVED].zprofile does not export custom $PATH

grep $USER /etc/passwd # there's no password in that 

Offline

#15 2023-10-15 16:25:28

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

dwm:x:1000:1000::/home/dwm:/bin/zsh

Offline

#16 2023-10-15 16:40:21

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

Re: [SOLVED].zprofile does not export custom $PATH

Does your zprofile trigger startx?
What does the environment look like when you skip that?

Offline

#17 2023-10-15 16:41:21

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

no it does not because zprofile is not triggered at all

I run startx myself after I log in

Offline

#18 2023-10-15 17:13:45

loqs
Member
Registered: 2014-03-06
Posts: 18,865

Re: [SOLVED].zprofile does not export custom $PATH

What is the output of `printenv` after you log in before you execute anything else?

Offline

#19 2023-10-15 17:44:26

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
EDITOR=vim
XDG_SEAT=seat0
PWD=/home/dwm
LOGNAME=dwm
XDG_SESSION_TYPE=tty
SYSTEMD_EXEC_PID=5282
XAUTHORITY=/home/dwm/.Xauthority
WINDOWPATH=1
MOTD_SHOWN=pam
HOME=/home/dwm
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/system-getty.slice/getty@tty1.service/memory.pressure
INVOCATION_ID=4e595e962910421a9818822ab23ff8e5
XDG_SESSION_CLASS=user
TERM=st-256color
LESS_TERMCAP_mb=
LESS_TERMCAP_me=
LESS_TERMCAP_md=
ZDOTDIR=/home/dwm/.config/zsh
USER=dwm
DISPLAY=:0
SHLVL=3
LESS_TERMCAP_ue=
LESS_TERMCAP_us=
XDG_VTNR=1
XDG_SESSION_ID=7
XDG_RUNTIME_DIR=/run/user/1000
QUOTING_STYLE=literal
DEBUGINFOD_URLS=https://debuginfod.archlinux.org
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/dwm
OLDPWD=/home/dwm
WINDOWID=10485766
_=/usr/bin/printenv

Last edited by b42 (2023-10-15 17:45:46)

Offline

#20 2023-10-15 18:33:59

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

Re: [SOLVED].zprofile does not export custom $PATH

ZDOTDIR=/home/dwm/.config/zsh

Where's your .profile located?

TERM=st-256color
loqs wrote:

after you log in before you execute anything else

roll

And why is $SHELL not set?
There's something massively fishy with that config.

Offline

#21 2023-10-15 19:53:50

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

seems like I do not have a .profile file.

as for $SHELL, when I do echo $SHELL it gives /bin/zsh so $SHELL must be set

Offline

#22 2023-10-15 20:01:31

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

Re: [SOLVED].zprofile does not export custom $PATH

I meant ".zprofile", sorry (though could have been obvious) and there's no way that you can echo $SHELL but it doesn't show up in printenv. Did you edit the output?

Offline

#23 2023-10-15 20:34:50

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

.zprofile is located in /home/dwm directory

No I did not edit anything

Offline

#24 2023-10-15 20:54:32

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

Re: [SOLVED].zprofile does not export custom $PATH

… and what is your zdotdir?
Not even ~/.zshrc should be sourced w/ that setup.

Offline

#25 2023-10-15 20:58:03

b42
Member
Registered: 2023-07-20
Posts: 195

Re: [SOLVED].zprofile does not export custom $PATH

~/.config/zsh

Offline

Board footer

Powered by FluxBB