How to write your first shell script

Launch a terminal vi, nano or any other prefered editor of your choice. I will be using nano as a editor.

At the top type the following code #!/bin/bash. This is known as a Shebang line.

This script prints a header line then list directories and a footer message in script.

Now to come out of the nano editor, press escape and save changes.

Now we need to make this Shell Script, executable. To do this, enter the following command

To run this Shell Script, simply type

You should get the list of directories