5

Hello I'm trying to make a Shell script in opensuse to create MySqlUsers but when I try to run it I get this error:

Warning: Could not start program '/home/thomas/Scripts/MySqlCreateUser.sh' with arguments '/home/thomas/Scripts/MySqlCreateUser.sh'.

Warning: Exec format error

Any Idea what I can do?

Inian
  • 80,270
  • 14
  • 142
  • 161
Thomasttw
  • 67
  • 2
  • 9

2 Answers2

12

I'm guessing you are trying to start this from a KDE menu item.

You need to make sure that:

  1. Your script has a proper shebang on the first line (like #!/bin/bash)
  2. Your script is executable (chmod +x /home/thomas/Scripts/MySqlCreateUser.sh)
Grisha Levit
  • 8,194
  • 2
  • 38
  • 53
  • Huge thanks, I did the first step and it works, do I need this line in all my shell files? – Thomasttw Feb 02 '17 at 09:29
  • Yep. That line tells the OS that this is a bash script and not some other kind of script or a binary. You can search StackOverflow for "shebang" to get some related information. – Grisha Levit Feb 02 '17 at 09:36
0

Addendum to Grisha Levit's answer: If the .sh file is simply a "java -jar ..." then just enter "java -jar ..." as the cmd in the KDE Menu Editor.