I've written a bash script found at directory:


that performs the following:



This is to run the clion.sh script found at:


If I open a terminal in /home/harmelodic/.Jetbrains/ and perform:

$ ./CLion.sh

It successfully runs and opens the CLion IDE.

However, if I use a launcher from Application Finder to perform a Command to execute the script (as shown below), the CLion IDE fails to open.

enter image description here

I'm completely stumped. I thought the Command input would run the script fine but it doesn't.
I've ensured that the script is executable and that it runs via terminal but it refuses to run via the launcher found in Application Finder.

Why, and how do I fix this?

  • It's probably not a good idea to use a relative path like ./clion*/bin/ in this context – steeldriver Oct 29 '16 at 16:32
  • so.... use an absolute path. (e.g. /home/you/path/to/clion) – grooveplex Oct 29 '16 at 16:34
  • How come? I'd like it to be portable and there is only one directory that starts with clion so the * works fine afterwards. Besides, it works in the terminal and I'm happy with the relative path-ness I just want to know why it won't work in the launcher. – Harmelodic Oct 29 '16 at 16:34
  • It's the ./ that makes it relative (to the current directory, .) - when run from a launcher, what do you expect . to be? – steeldriver Oct 29 '16 at 16:42
  • I'm running the bash script from the launcher using a absolute path. Surely when the bash script runs a relative path, it just treats the directory the script is in as the point to go from when using a relative path? – Harmelodic Oct 29 '16 at 16:50

Well, we had a PEBCAK error...

I mistakenly thought that if I ran the script, the script would automatically know where itself was and would use it's current location as a relative path.
This is not the case, it turns out. The script will treat whatever location the user is running the script from as the path to use when referring to relative paths.

Meaning that if I went to /home/harmelodic/ and ran:

$ ./.Jetbrains/CLion.sh

The script would fail as it would look for /clion*/bin/clion.sh in:


instead of


The solution was to get the current directory of the script and then perform the command using the current directory combined with the relative path to mimic a relative path whilst actually using absolute paths:


CURRENT_DIR=`dirname $0`


This works from any directory, meaning that it works within a launcher from Application Finder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.