4

I am unable to run .sh file in Ubuntu 14.04. The same file was executing in earlier version 12.xx. After upgrading to 14.04, this file stopped running. How to resolve this issue?

  • 5
    Did your script have execute permissions http://askubuntu.com/a/38666/265974 ? What is the content of the script? – TuKsn May 18 '14 at 12:39
  • How are you trying to execute script: using the command line or from the graphical interface? What do you get when you try to execute? – jobin May 20 '14 at 14:07
  • Impossible to say --- what means "stopped running"? Could be that the script rely on a command or interface which is not here anymore. Try to run the script in a terminal and edit your answer with the output. – Rmano May 20 '14 at 14:17
  • I am assuming you already have this since it worked earlier, but please cross check to see you have "#!/bin/sh" as your first line. – Swarnendu Biswas May 20 '14 at 14:19

2 Answers2

7

All that you need to do is set default action here File Manager > Edit > Preferences > Behaviour forExecutable Text Files. In Ubuntu 14.04 it is set to View Executable Files when they are opened

eldos
  • 186
3

You can check whether or not the script is executable by doing something like:

$ ls -l nameoffile

replacing nameoffile with the name of the script. The output will look like:

-rwxr-xr-x  1 users users 848101 Mar 12 11:22 configure

The last x in the first column, means that this file is an executable. If this x is missing, it means that the file is not executable. You can easily fix this. To make a script executable, you can execute:

chmod +x /path/to/nameofscript.sh

After that to execute it from the command line, you can do:

./path/to/nameofscript

Xubu-tur referenced a very good explanation for doing this from a graphical environment.

jobin
  • 27,708
BakaKuna
  • 188
  • I don't know that install-sh is supposed to do. But looking at the output my guess is that it wants some kind of input. – BakaKuna Jul 20 '16 at 09:14