That's not quite correct, at least on my distro.
bash_profile is loaded with login shells, and
bashrc with non-login shells. The INVOCATION section of your bash man page will detail which files are called in which situations on your system.
But the real problem here is that guis don't launch programs and scripts from a "shell", they call on your system's execution routines directly. Or something like that. The important thing is that it's not done in the context of a shell environment.
You generally need to ensure that all needed variables are set within the script itself, or else run the script with a terminal program, with the desired environment set at the beginning. One way to to that is to prefix your command with the setting (variables set immediately before a command are placed in that command's environment).
I just did this as an example. I wrote a quick script:
Code:
#!/bin/bash
echo "[$foo]"
exit 0
Then set up my menu button command like this:
Code:
foo='hi there' konsole --noclose -e '/home/david/test/script.sh'
When I ran it, a konsole window opened up, with "[hi there]" printed in it.
A final option may be to use your
/etc/environment file to designate system-wide environment variables. (Note that this file isn't a full shell file, and can only contain "name=value" pairs.) I wouldn't recommend this for trivial settings though.