Hello .
Preamble :
Depending of the opensuse distrib :
Login shell read :
- /etc/profile
- /etc/profile.local ( for customization )
- eventually for specific programms : /etc/profile.d/
- ~/.profile for user specificity
Non login shell read :
- /etc/bash.bashrc
- /etc/bash.bashrc.local ( for customization )
- ~/.bashrc for user specificity
Note that the login shell also sources the configuration files listed for non login shell.
What I have done :
I have configured '/etc/profile' to source two files
One file contains a list of global environment variables
export NAME=VALUE
The other file contains function definitions
function MY_FUNCTION () {
........
........
}
export -f MY_FUNCTION
Using logger commands here or there, and reading the journal, I know that the two files are sourced as soon as I log on as a normal user.
I am using KDE graphical environment.
The problem :
- I have a script that I can start from a shortcut on the user's desktop or from a command line by typing the script name ( including the full path ).
- The short is configured to run the file in konsole (kde terminal) and to stay open when finished.
- The short is configured to run the file as a normal user.
A -)
- I start a session in a terminal using kde konsole.
- When I run a bash script from command line all my environnment variables are set and accessible, and all my functions are defined and accessible
.
B - )
- I start the program by clicking on the desktop shortcut icon.
- All my environnment variables are set and accessible, nad all my function are undefined.
My question :
What is the inheritance of a bash script executed from a shortcut on the desktop.
Any help is welcome