[Linux] Shell Scripts

Source: Internet
Author: User

    • Shell script is a "program" written using the shell's function, which uses plain text files to write some shell syntax and instructions (including external instructions), with regular expressions, pipeline commands, and data flow redirection. In order to achieve the purpose we want to deal with.
    • Shell script is a good tool for system management, but it is not good enough to handle a large number of numerical operations, because the shell scripts slower and uses more CPU resources, resulting in poor allocation of host resources
    • In the shell script file, the execution of the instruction is analyzed and executed from top to bottom, left to right.
    • The execution of the shell script requires at least R permission, and if a direct command is required, you need r and X permissions
    • Good program writing habits, the first line to announce the shell (#!/bin/bash), the second line after the declaration of the application, version, author, etc.
    • Can be reached with a read command on a talk-through script
    • To create data that has different results for each execution of the script, use the date command to reach
    • The execution of a script, if executed as source, means that it is executed within the parent program's bash
    • If you need to make a judgment, you can use test or brackets ([]) to handle
    • In script, $, $, $ ..., [email protected] is a special meaning.
    • Conditional judgments can be judged using if...then, which can be handled using case $var in ... esac if the contents of the variable are fixed.
    • Loops are mainly divided into indefinite loops (while, until) and fixed loops (for), with do and done to achieve the required tasks

[Linux] Shell Scripts

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.