Linux commands (10)--shell programming one (variables and operators)

Source: Internet
Author: User
Tags chmod

The shell is an interface between the user and the system in a Linux system, and it is a high-level programming language, in addition to being the command interpreter. In the Linux command described earlier, the shell appears as a command interpreter. The following two sections briefly introduce the syntax structure, variable definition and assignment, special symbol, control statement and so on in the script programming.

I. Creation and execution of shell scripts

1. Build : Create a script file--vi edit the/cat command to write the program line to a file

2. Execution :sh < script name input directional execution mode

    sh script name [parameter] takes the names of the scripts as the execution method of the shell parameters

    chmod a+x Script name +./script name changed to execute right

    chmod a+x Script name + CP script name/bin + script name change to executable permission and move file into directory under command search path

Second, the shell variables

As with other high-level language variables, it is a flag that can represent information such as numeric values, strings, and so on, a primary deposit element that is given a name.

The name of the shell variable can be made up of numbers, letters, and underscores. There are two types of shell variables, shell environment variables and user-defined variables.

1.Shell Environment variables

(1) Writable shell environment variables

(2) Read-only shell environment variables

2.Shell user-defined variables

Iii. special characters in the shell

Wildcard characters for 1.Shell

2.Shell of quotation marks

Command execution sequence operator for 3.Shell

Annotations, backslashes, and background operators in 4.Shell

Iv. input and output commands in shell programming

Standard files for input and output in 1.Shell

2.Shell input and Output redirection command

3.Shell input and Output commands

Because we have not learned this piece of content, first outline, study after the detailed explanation and supplement.

Linux commands (10)--shell programming one (variables and operators)

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.