2

Currently in Ubuntu 16.04 and can't open Shell files with terminal (as the default program). I can make them run normally with sh after directing to the directory; however always used to be able to "Execute in terminal". Any helps would be appreciated. Thanks!

0

Most probably, there are a few things to check :

Make sure you are running your shell file on a way that lets understand to your terminal that it is a file that is stored in the current folder. For instance, if the filename of your script is myscript.sh, do not type myscript.sh but ./myscript.sh. If you don't, the terminal would think that the script is in an other place, such as

/bin/
/usr/bin
/usr/sbin
/sbin

the most of the time, concerning installed or system commands. The dot refers to current folder, whereas two dots (..) refer to parent folder.

The other point you can check, is that you have the permission to execute the file. If you are running Ubuntu, right click on your file -> properties -> permissions -> check "Allow execution as a programm".

I'm not sure, but you may also need to begin you script with following line : #!/bin/sh, altough I've already used script without such a header line.

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.