Registered Member
|
Hello,
I have a script which gets called by .bashrc and sets some variables. Among other things the script modifies the path variable. Does anybody now how make these environment variables available to krunner? Adding the cripts file to "System Settings" -> "Autostart" -> "Script File" doesn't work for me. Regards Martin |
Manager
|
do you export the variables?
have you tried placing the variables in ~/.bash_profile update - so I looked at mine and I don't export $PATH (though I do the variables I set) and Krunner finds executables that are in my PATH. If you echo $PATH in Konsole does your path show correctly? do your variables? |
Registered Member
|
I got it working. I've created a .xprofile file in my home directory as neither .bash_profile nor .bashrc get called by kdm.
The .xprofile file calls .bash_profile which in turn calls .bashrc. One thing I like to know though is why .xprofile gets called two times during login? Also the PATH environment variable gets reset between the two calls. Can anybody tell me where the places are where the PATH environmnent gets set during the login? |
Manager
|
this sounds wrong to me, if you login a virtual terminal (Alt+Ctrl+F1) is your bashrc called? because obviously xprofile won't have called it
|
Registered Member
|
Ah, I was wrong only .bashrc and .bash_profile get called two times after login. But I still don't understand why these two files are called two times. At least there is no terminal open and I don't see a bash process.
|
Manager
|
you never said if those variables were showing in Konsole before you added them to .xprofile
|
Registered Member
|
Hello
I dont's understand your last replay. When I open konsole .bashrc and .bashprofile get executed. When I login to KDE .xprofile get executed one time, which in turn will call .bashprofile which will call .bashrc. Then .bash_profile gets called a second time. So the sequence looks like this (at least I assume this is what's happening): Time 1: .xprofile -> .bash_profile -> .bashrc (set PATH variable) Time 2: PATH variable gets reset Time 3: .bash_profile -> .bashrc (set PATH varialbe again) Hope this clarifies things. |
Manager
|
what I don't understand is why your system is not executing .bash_profile at login which is how I understand it is supposed to happen.
|
Registered Member
|
You are right: .bash_profile gets executed without .xprofile.
The reason why I was calling .bash_profile from .xprofile was that the "Application Launcher" didn't seem to recognize the changed PATH variable and I thought that when I set the PATH variable earlier it would see the new PATH environment. I've removed the .xprofile file now and .bash_profile gets called. Somehow the "Application Launcher" now also sees the changed PATH variable. Thanks a lot for pointing me to the right direction! I have no idea what the problem was, or if there ever was a problem in the first place. At least it works as expected now. |
Manager
|
I was just confused because Krunner sees my PATH no problem
glad it's fixed, please mark thread solved |
Administrator
|
I will also note that KDE allows you to have an "env" folder in your localprefix, containing shell scripts which set up environment variables. These scripts must be executable.
Your localprefix can be found by executing:
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Manager
|
there is a kcm module for facilitating this for scripts located not in the ~/.kde[4]/env fordler: systemsettings -> startup and shutdown -> autostart -> script files -> add script (as symbolic link) -> pre-KDE startup some people call thier env file myenv.sh |
Registered Member
|
I wanted to set the environment variables in .bashrc because they are not KDE specific and setting them in this place makes them available for other DEs also.
|
Registered Member
|
I think you shouldn't set/export environment variables in .bashrc but in .profile instead, because this is the file that definitely gets included by the display manager (e.g. lightdm) - which boots your graphical environment - no matter what is your login-shell setting. See: /usr/sbin/lightdm-session (shell script, Ubuntu-12.04).
If you have a ~/.bash_profile, make sure to include .profile from there:
If you run a program within the graphical environment via ALT-F2 (KRunner), no new shell is started, so .bashrc will not be included at that time either. Only the exports you did in ~/.profile will be active. You can do the code underneath to see KRunner's environment variables:
I pursued this problem while trying to set the BROWSER environment variable. See: http://fvue.nl/wiki/Linux:_Default_browser |
Administrator
|
Note that if you are concerned that ~/.bashrc or ~/.profile are being ignored, a executable *.sh file under ~/.kde4/env/ will always be included by startkde as part of the KDE startup process. Note that ~/.kde4/ may not be correct for your distribution (in which case use ~/.kde/) and that you may need to create the 'env' folder yourself.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]