.sh is an extension for a shell script. A shell script is a file that is executed directly run by the "shell". For example, a
.c file is compiled by the C compiler like
Turbo C, etc. Similarly there are shells like bash, Bourne shell, etc which are also called as command-line interpreters which execute this
So, in order to run a
.sh file, you can try any of the following at the
terminal (the command-line interface) by first going to the directory in which the file is located:
1) For executing using a particular shell:
which is in your case:
If you have installed Ubuntu, you should have bash by default.
2) For executing using the default shell:
chmod +x filename.sh
which is in your case
chmod +x update_java_home.sh
chmod is a command to change the file permissions.
+x gives executable rights to the user logged in, if permissible, upon the file given as
. indicates the path is the current directory and asks the shell to execute the file gives as filename.
These are perhaps the most common methods used to execute shell scripts. There may be other methods too.