Special characters of the shell

Source: Internet
Author: User

Bash is a powerful scripting language, which is the default shell in many Linux occurrences, supports variables and special characters, and looks at what special characters it has:

; Command delimiter, you can write multiple commands in one line

;; Terminate case option

. Shell built-in command, equivalent to source,

. As part of the file name, if it is a prefix, it is represented as a hidden file

. Character matching, which represents a single character in a regular expression

"Double quotes, weak references, can implement variables

' Single quotes, strong references, reference characters themselves

\ escape Character

' Post reference, command replace '

: Empty command, just do nothing, in script: > A.txt equals cat/dev/null > A.txt

! Take the inverse operator, the shell keyword

* Any word matching, in arithmetic operation * * is a power operation

${} reference variable

$? Exit state variable

$# the number of parameters in a bash script

$* [email protected] A list of parameters represented in a bash script

$ A script name

() command group: For example: (A=3;echo $a), note the variable in () whose use is limited to () and produces a child shell run

{A, B} curly brace extension, such as cat {A.txt,dns.sls} > C.txt

An expression of [] test that represents the range of character matching in a regular expression

(()) Extension of data calculation

> Standard output redirection

2> Error Output redirection

&> Redirect all outputs

< output redirection

|| Or, the logical operation

&& and, logical operations

{} code block, this structure creates an anonymous function, but unlike a function, the declared variable is visible to the rest of the script.

Such as:

#!/bin/bash

A=5

{a=123;}

Echo $a #a =123 describes the modification of variable A in the code block, which affects the outer variable a


-For redirecting stdin or stdout, such as: Ls/root | Cat-or grep ' C ' a.txt | Diff C.txt-

^ indicates positioning to the beginning of the line






This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1916402

Special characters of the shell

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.