First linux shell script

You should remember below things while writing the scripts.

  1. Every script should being with “#!/bin/bash”
  2. Comments can be added by prefixing the line with #

We are going to write a simple program in our first script. Write below lines of code in a file and name it as



echo $x

Before you execute above command, ensure that you modify the permission of the file so that you can execute it.

chmod +x

To execute this program, just go to the shell prompt and type ./

This should generate below output.


You may also like...