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!
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. 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.