Special characters in the shell

Source: Internet
Author: User

Introduction [54,17]

Bash itself does not support regular expression regex, while some tools under the shell support the interpretation of Regex , and the use of regex is Shell commands and tools , such as Grep,sed,awk. but the shell supports wildcard characters , which are different from regex, and the wildcard is to store a non-specific file name extension that contains wildcards in the computer , The process of a batch of specific file names on a server or network .


Wildcard file name matching

Wildcards are used to match file names, path names, including commands, and typically combine four kinds of wildcard methods . a Linux file name can use any printable character except/out (the opening and closing of a file name is difficult to identify unless intentionally, avoid using spaces and tabs to name the file to avoid unnecessary hassles). Files that begin with a. File are hidden.


? * [] {} ^ and internal variable globignore make up all the contents of the shell wildcard.

*

Matches 0 or more characters (except for the beginning of the.), which can be matched to another location, which may be an empty string

?

Matches any single character except the first character (except for the beginning of the.) and does not match the null

[...]

Match any one of the characters in the list or range

[^...]

Match any one of the characters given in the list or out of range

{}

Represents a collection of a set of strings


Using the example

[ABCD] match any one of the ABCD characters

[A-h]   Any one of the characters in the a-h

[0-9] match any number in a 0-9

[A-za-z0-9]

[!0-9]

Mkdir/touch Test{a,b}

MKDIR/TOUCH/TEST/{A,B}

LS [xyz]*.conf


Shell Special Symbols

About referencing Quote

A reference is a string that is caused by a reference symbol to prevent special characters from being re-interpreted by the shell script to other meanings, and to screen special characters for special meanings , and to interpret them as literal meanings, which are used to refer to characters that have escape characters \, single quotes ' double quotes '

The shell only wants to treat the special characters it handles as ordinary characters. bash Shell has three ways to avoid characters being interpreted by the shell .

650) this.width=650; "src=" Http://img1.51cto.com/attachment/201411/14/2363901_1415948869EPa2.png "/>

Other special characters

650) this.width=650; "src=" Http://img1.51cto.com/attachment/201411/14/2363901_1415948885t8Pa.png "/>

This article is from the "Adelphos" blog, make sure to keep this source http://adelphos.blog.51cto.com/2363901/1576530

Special characters in 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.