This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KDE Menu launches bash scripts without environment variables

Tags: None
(comma "," separated)
User avatar
iskendar
Registered Member
Posts
48
Karma
0
OS
Hi all,

Trying to set up a little OpenCV demo for our open door at work, so I wanted to launch a bunch of scripts from the desktop. Tried adding them to the start menu, didn't work. Set 'Run in terminal' with the option --noclose, and then I saw that obviously some paths were missing. Apparently the shell starts without running .bashrc, so none of the environment variables are set (checked this). Clicking the script in dolphin or a folder view: same problem.
If I just start up a terminal and run the script from the command line, it works no problem. What am I missing here?

Running Kubuntu 11.10 with kde 4.7.


iskendar, proud to be a member of KDE forums since 2008-Dec.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Does the script in question have a Shebang which invokes a Bash shell interpreter? It could be using /bin/sh - which if i'm not wrong is dash under Kubuntu.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
iskendar
Registered Member
Posts
48
Karma
0
OS
bcooksley wrote:Does the script in question have a Shebang which invokes a Bash shell interpreter? It could be using /bin/sh - which if i'm not wrong is dash under Kubuntu.


Script starts with #!/bin/bash, yes. I tried changing it with
#!/bin/bash -rcfile /home/me/.bashrc
but it wasn't allowed.

Putting all of the env variables into the script itself worked, though it's obviously not the most elegant solution.


iskendar, proud to be a member of KDE forums since 2008-Dec.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If you add the following at the top of the script (just below the shebang), does it work?
Code: Select all
source ~/.bashrc


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot]