🚀 Learn 90+ coding courses & crack 200+ competitive exams — powered by learning intelligence on Leyaa.ai →

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.


Example

vim filename.sh




How to run shell script in Linux

Method 1:

sh filename.sh

Method 2:

./filename.sh




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.


Example

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

chmod +x filename.sh.


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

+x - It makes the file executable.


🚀 Code smarter. Crack exams faster.

90+ interactive coding courses & 200+ competitive exam prep — powered by learning intelligence. All free.

Try Leyaa.ai Now →

Topics You Might Like