[SOLVED] Can't start bash script / starter

I can’t start .sh bash scripts. The script is executable, but when double click only text editor will open. I have created a starter
[Desktop Entry]
Name=AndroidStudio
Exec=/home/ich/Android_Tools/android-studio/bin/studio.sh
Icon=/home/ich/Android_Tools/android-studio/bin/studio.png
Terminal=false
Type=Application
but still won’t start the studio.sh
Also when using ‘ProgramStarter’ the script isn’t starting.

How to solve

Lots of things can be wrong, so let’s discard the most obvious possibilities

In a terminal, what does the following commands print ?

  • Listing the file with some metadata details:
    ls -l /home/ich/Android_Tools/android-studio/bin/studio.sh
  • Printing the first line of the script to verify the Shebang:
    head -1 /home/ich/Android_Tools/android-studio/bin/studio.sh
  • Verifying the syntax of the script, should not print anything:
    bash -n /home/ich/Android_Tools/android-studio/bin/studio.sh
  • Executing the script in the terminal, directly from the current directory, or the script directory:
    first /home/ich/Android_Tools/android-studio/bin/studio.sh does it work correctly ?
    or cd /home/ich/Android_Tools/android-studio/bin; ./studio.sh does it work correctly ?

Once those are okay we can look further

2 Likes

Is the script executable?
chmod +x /home/ich/Android_Tools/android-studio/bin/studio.sh

1 Like

Already done. As I have written, the script is executable

If I run in terminal
./home/ich/Android_Tools/android-studio/bin/studio.sh
or bash /home/ich/Android_Tools/android-studio/bin/studio.sh
The program ( Android Studio) is starting. All fine

cd /home/ich/Android_Tools/android-studio/bin; ./studio.sh does it work correctly ?

Yes, it’s working

The other points I will check tommorow

If you’re using Nautilus, go to its Preferences -> Behavior and have it execute the script instead of viewing it in text editor.

man I bad at reading! I see it now :slight_smile:

Ok, no need to check anything else I asked, @Gavaudan gave the solution to your problem

I want use a desktop shortcut

There is no Behavior. I’m on latest PureOSVersion

point 1
ich@LeOS:~$ ls -l /home/ich/Android_Tools/android-studio/bin/studio.sh
-rwxr-xr-x 1 ich ich 10028 1. Jan 2010 /home/ich/Android_Tools/android-studio/bin/studio.sh

point 2
ich@LeOS:~$ head -1 /home/ich/Android_Tools/android-studio/bin/studio.sh
#!/bin/sh

point 3

  • bash -n /home/ich/Android_Tools/android-studio/bin/studio.sh — nothing happens

point 4
both commands working. Studio is opening

I have changed the topic to solved, because I will stop use PureOS. I have tried it one year ago and have had to much issues. And it seems it still have to much issues/problems.

So I will swap to a ‘working’ distro. But anyway: Thx for your help