Bash Shell Script – 1

Bash Shell Script - 1

Bash shell scripting is collections of Linux commands in a single file and we should know where and when to use the command. Its mandatory to know all the basic commands for bash shell scripting.

Execute permission is must to run the script.

Using below command will add the execute permission to a file.

#chmod +x

Here am using file for simple script.

Now check using “ll” command whether the permission has been added or not.

#ll | grep -i

We can use three methods to execute the bash shell script.

1. ./
2. sh
3. bash

Here am writing script to display a string.
Echo command will do simple printing whatever we are giving with double quotes.

Already i have created testscript file using vi editor.


Now will write a script to display Current logged in user, date and Count of users logged in.
Use the vi editor to create script file.


type the below set off commands to create this script.

Save and exit from the file.

change the permission using chmod command.

#chmod +x

Now run the script and check for the output.

like above will create bash shell scripts for our requirements.
Will see some other examples in next post.

Leave a Reply

Your email address will not be published. Required fields are marked *