How to create shell script on CentOS and RHEL 6/7 step by step guide

How to create shell script on CentOS and RHEL 6/7  step by step guide


In this article we will learn how to create shell script and execute it on CentOS and RHEL linux system.

Shell script is very powerful language for a system admin to execute the daily basic staff.

================================

How to create shell script on linux system

=====================================

Now we are going to write one small shell script program to understand how to write shell script on the linux system  .
First we create one empty file named test.sh using the below command.

#touch test.sh

After creating empty file we enter the below line in the file.

#!/bin/bash
echo Welcome to TechRiderAdmin

note: we shoule use #!/bin/bash to identify this script only run in bash shell not the other shell .

===========================

How to execute the shell script program

=======================================
To execute this program we need to give execute permission on the test.sh file execute the below command.

[root@localhost ~]#chmod u+x test.sh

After execute the above command we can run the script using the below command.

[root@localhost ~]#sh test.sh
How to create shell script on CentOS and RHEL 6/7  step by step guide
How to create shell script on CentOS and RHEL 6/7  step by step guide


That’s all. If this article is helpful please share it!!!!






Please Donate To Bitcoin Address: [[address]]
Donation of [[value]] BTC Received. Thank You.
[[error]]
SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment