Shell Programming-Initial

Source: Internet
Author: User

Programming languages are generally divided into static languages and dynamic languages.

Static language: Compiled language strongly typed (variable) pre-compiled

Example: C C + + Java C #

Dynamic language: Interpreted language weak type (default variable type is not distinguished, and the default type is String type)

Example: PHP Shell python perl


Object-oriented : Java python

process oriented : Shell


variables : Memory space, named memory space #能回收

memory : addressable memory space


the types of variables can be divided into: character, value, true and false declaration variable type is the role of predetermined storage format and length

logical Operations : with, or, non-, XOR, or

#非门在现实中使用电磁感应, switch closed circuit.


the variables in bash can be divided into: environment variables , local variables (local variables), positional variables, special variables

Local Variables ; Varname=value acting on the entire bash process

reference variable $ (VARNAME) variable can sometimes be omitted

Locals local Varname=value acting on the current code snippet

Environment Variables acting on the current shell process and its child processes

Export Varname=value "Exporting"

The child shell process is started as the script executes

The command-line startup script inherits the environment variables of the current shell

Scripts that are automatically executed by the system (not command-line startup) require a self-defined environment variable

position Variable $1,$2

Special variable $? Save Last Command execution status return value

Program status return code 0: Execute correctly

1-255: Error 1.2.127 System reservation

Output REDIRECT :>,>>,2>,2>>,&>

Example: ID username &>/dev/null #/dev/null for data black hole bit bucket

Undo Variable unset VARNAME #创建变量为

View variable Set

View the current shell environment variables printenv ENV Export


environment variable Add : String variable can be used, such as export path= $PATH:(add pathname)






This article is from the "11994222" blog, please be sure to keep this source http://12004222.blog.51cto.com/11994222/1854882

Shell Programming-Initial

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.