OS: Kubuntu 22.04, freshly installed.
I have script called test.sh:
echo $PATH
sleep 10
when I call it by clicking on file by mouse right button
and choose run in Konsole
the echo $PATH
shows:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
but when I call it by firstly entering terminal Konsole
and switching directory to directory of test.sh
and then call it by typing command: ./test.sh
then echo $PATH
shows:
home/myuser/.nvm/versions/node/v16.18.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
that is because i've installed something (node.js) before (in terminal by apt-get). As I understand, Desktop Enviroment has his own PATH
variable, that is why that PATH
(first one) doesnt has home/myuser/.nvm/versions/node/v16.18.0/bin
part at the begining.
So I've decided to modify Desktop Enviroment's PATH
manually. In order to do this, I've created a file called .xsession
and fulfill it with:
#!/bin/bash
export PATH="/home/myuser/.nvm/versions/node/v16.18.0/bin:$PATH"
and I've put that file inside my home directory right beside .bashrc
and .profile
files.
As far as I know Linux will run this file when I log in to my user again. So I've logged out and logged in and tried calling test.sh
by clicking on it and choosing run in Konsole
from drop-down menu. But it shows PATH
the same way as before, without my additional part.
I am using Kubuntu 22.04 and I saw autostart options in settings App, so I've added my script there also, but with different name because .xsession
wasn't allowed there. Still after logging out and logging in nothing works as expected.
What else can I do to modify PATH
of Desktop Enviroment on start? Did I sth wrong?
EDIT:
.xsession
file is called, because I've added read
command at the bottom of that file, and after logging in I see process running that file in process list. But why it does not modify PATH
as it should?