How to create the shell script in Linux

We can create the shell script file using any text editor like vim, gedit etc.

But the file extension should be .sh.



How to run shell script in Linux

Method 1:


Method 2:


Permission denied error while executing the shell script

While running the shell script, if we get "Permission denied" message we should give executable permission to the file.


We can provide the executable permission by using the below command,

chmod +x

chmod (Change Mode) - Using chmod we can change the access permissions to file system objects.

+x - It makes the file executable.

Topics You Might Like