The path to shell script self-learning-opening the door, a brief introduction and use

Source: Internet
Author: User

First, we will not introduce what shell scripts are. This blog only records every step of learning shell scripts.

First, we will introduce the basic shell rules:

The shell script is not a complex program. It is explained by line. The first line of the script is always #! It starts with/bin/sh and notifies the Shell programs below the system to use the Bourne shell on the system for explanation. Write the script name in the second line of comment, and the third line of Comment begins to write the script function-habit. The VI editor is generally used to compile shell scripts.

Next we will officially enter the first step of our shell programming:

Enter

sudo vi showhello.sh

To edit the script. Please query (click to open the link ).

Next, enter the following content into VI and enter WQ in the last line mode! Save and exit,

#!/bin/sh#ShowHello.sh#To show hello to somebodyecho -n“Enter Your Name:”read NAMEecho “Hello,$NAME!”
Then, add the executable permission to the script file:

chmod u+x showhello.sh

 

The script file is finally executed.

source showhello.sh sudo ./showhello.sh 








The path to shell script self-learning-opening the door, a brief introduction and use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.