Bash-script – doesn't work in a launcher

Johnny Rosenberg gurus.knugum at gmail.com
Sat Dec 31 17:00:21 UTC 2011


I made a bash script that I want to run by clicking an icon on my
upper panel in Ubuntu 10.10. The script runs perfectly in a terminal,
but it doesn't do much if I start it by clicking the icon in my panel.
I added the icon by creating a launcher the usual way.

So I changed the launcher from ”program” to ”program in terminal” to
be able to see what happens, if anything. I then found that it
produces error messages at every ”let” and ”[[”, which I guess are
bash specific, so it seems like sh is trying to run my script, not
bash.

Of course the first line of the script is #! /bin/bash. Well, except a
few comment lines above it, but that shouldn't matter, should it?

So it's basically something like this:

# Comment
# Continuation of comment
# Another comment
# More comments

#!/bin/bash

The script, including some bash specific things like ”let a=b*c” and
”if [[ something ]]; then”.

As I said, the script works perfectly from a terminal, no problems at all.
When launching it from a launcher, it seems like all bash specific
commands suddenly are unknown to the system, why is that? I guess I am
missing something, but what?


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ




More information about the ubuntu-users mailing list