You are not logged in.

#1 2017-06-01 11:36:11

menfie
Member
Registered: 2016-12-18
Posts: 12

[SOLVED] My scripts are not working without full path

Hi everyone, yesterday this problem occured from nowhere and I'm unable to fix it on my own so I thought maybe someone could help me.

So on my ".zshrc" I'm adding my "~/.scripts" folder to the path like this: "export PATH=$PATH:$HOME/.scripts" so on my terminal (urxvt) I can run my scripts without entering full path. But from outside of terminal, like my i3 config, dmenu, xbindkeys and so on they are not working and I have to type full path in order to get them working. So while I can just type "screenshot" on my terminal, I can't do that on dmenu. My system is up to date and working perfectly fine except this issue.

Last edited by menfie (2017-06-01 13:04:47)

Offline

#2 2017-06-01 11:42:33

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] My scripts are not working without full path

How do you start i3? With xinit/startx, or with a display manager?

In general, it is recommended to export variables in .zprofile, otherwise you'll keep appending paths to $PATH each time you spawn a new shell from within a shell.


pkgs │ hacks │ cfg │ blag

Offline

#3 2017-06-01 11:55:06

menfie
Member
Registered: 2016-12-18
Posts: 12

Re: [SOLVED] My scripts are not working without full path

Ok, I moved the export Path to ".zprofile". I'm starting i3 with nvidia-xrun. I have "exec i3" inside ".nvidia-xinitrc" file like this: https://pastebin.com/Fw6qmS1G

Offline

#4 2017-06-01 12:07:42

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] My scripts are not working without full path

Note that you will need to log out and in again after applying those changes.

Also, from a quick glance at that nvidia-xinitrc, it seems that your personal xinitrc is not supposed to look like that—have you simply copied /etc/X11/xinit/nvidia-xinitrc to your home? Then again, I don't get why the project provides a global xinitrc like that...

Last edited by ayekat (2017-06-01 12:09:40)


pkgs │ hacks │ cfg │ blag

Offline

#5 2017-06-01 12:10:28

menfie
Member
Registered: 2016-12-18
Posts: 12

Re: [SOLVED] My scripts are not working without full path

Moving export Path to .zprofile is worse... Now whenever I login or open a new terminal I have to type export manually because it's not exporting... And on web I saw everyone suggesting ".zshrc" instead of ".zprofile".

ayekat wrote:

Note that you will need to log out and in again after applying those changes.

Also, from a quick glance at that nvidia-xinitrc, it seems that your personal xinitrc is not supposed to look like that—have you simply copied /etc/X11/xinit/nvidia-xinitrc to your home? Then again, I don't get why the project provides a global xinitrc like that...

I can't remember what I did back in the time but they look identical except I'm running i3. This is not something new I did it was like that before.

Last edited by menfie (2017-06-01 12:19:19)

Offline

#6 2017-06-01 12:17:10

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] My scripts are not working without full path

.zshrc is not the place to export variables. Especially not PATH (for reasons noted above). And on the web, people can suggest all sorts of things.

Please paste the output of these commands, after you log in on the TTY:

echo $PATH
ls -ld ~/.scripts

Also, please post your .zprofile. If exporting PATH in there does not work, it means that some other file overwrites it later on during login.


pkgs │ hacks │ cfg │ blag

Offline

#7 2017-06-01 12:28:57

menfie
Member
Registered: 2016-12-18
Posts: 12

Re: [SOLVED] My scripts are not working without full path

Okay, it was a typo (I had typed .script instead of .scripts) but still it works after the login but when I open a new terminal on X11 it's not.

Here is the outputs on a new tty: https://pastebin.com/jrTgqGbw
And this is on a terminal: https://pastebin.com/3vZcAnmX


.zshrc: https://pastebin.com/KACWWLNz
.zprofile: https://pastebin.com/04cnYeEJ  (I'm using auto login so it directly run X11)

Last edited by menfie (2017-06-01 12:31:36)

Offline

#8 2017-06-01 12:41:31

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] My scripts are not working without full path

menfie wrote:
if [ $(tty) = /dev/tty1 ]; then
  nvidia-xrun
fi

export PATH=$PATH:$HOME/.scripts

Ah! This explains it. You're running X before exporting the PATH variable.
Put the export before the nvidia-xrun lines and see if that works.

Also, (this is not very important, but) may I quote our overlord? smile

phrik wrote:

Pastebin.com is swamped with advertisements and random captchas. Malware found on pastebin.com has resulted in it being blocked for some users. It injects CRLF line-endings. Please, use something else. Use something sane like https://ptpb.pw https://gist.github.com https://bpaste.net https://ix.io

Last edited by ayekat (2017-06-01 12:44:14)


pkgs │ hacks │ cfg │ blag

Offline

#9 2017-06-01 12:44:31

menfie
Member
Registered: 2016-12-18
Posts: 12

Re: [SOLVED] My scripts are not working without full path

ayekat wrote:
menfie wrote:
if [ $(tty) = /dev/tty1 ]; then
  nvidia-xrun
fi

export PATH=$PATH:$HOME/.scripts

Ah! This explains it. You're running X before exporting the PATH variable.

Put the export before the nvidia-xrun lines and see if that works.

Now the terminal is perfectly fine! But I still can't run my scripts outside of my terminal without full path hmm There must be something I have done wrong while working on auto login...

Offline

#10 2017-06-01 12:53:35

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] My scripts are not working without full path

Not sure for the other applications, but dmenu_run keeps a cache file that is only updated if any of the files in $PATH are newer than the cache itself. Try removing .dmenu_cache (or $XDG_CACHE_HOME/dmenu_run), then running dmenu_run again.

To test if dmenu_run sees the right PATH, you can run this:

echo $PATH > blabla

The generated ~/blabla contains PATH as seen by dmenu_run.


pkgs │ hacks │ cfg │ blag

Offline

#11 2017-06-01 13:01:36

menfie
Member
Registered: 2016-12-18
Posts: 12

Re: [SOLVED] My scripts are not working without full path

"rm ~/.cache/dmenu_run" worked! Now dmenu can run my scripts, thanks to you! I think I can live with that since I don't think there is a way to fix every single app like this.

Edit: Suprisingly i3 is also fixed! Thank you again.

Last edited by menfie (2017-06-01 13:04:19)

Offline

Board footer

Powered by FluxBB