[Linux] shell, the application of anti-quotation marks ('), linuxshell

Source: Internet
Author: User

[Linux] shell, the application of anti-quotation marks ('), linuxshell
The quotation mark (') is located at the top of the Tab key of the keyboard and the left side of the key 1. Note the difference between it and the single quotation mark (') on the left side of the Enter key.

The reverse quotation mark (') is used to replace commands in Linux. Command replacement means that shell can insert the standard output of a command to any location in a command line.

For example:

Cl @ cl-OptiPlex-380 :~ $ Date October 29, 2014 15:14:46 CSTcl @ cl-OptiPlex-380 :~ $ Echo 'date' | cut-d'-f1-4 Wednesday, October 29, 2014

We can see that the date command in the back quotes ''is executed first, and then the date command output is replaced with the corresponding position.

Very valid metacharacters are often used in shell.





In the embedded linux shell, reverse quotation marks are not supported. How can this problem be solved?

If the shell is faulty and does not support this symbol, you need this string.
Date + % s | read tm
Echo $ tm

How to deal with single quotes, double quotation marks, and reverse quotation marks in shell

Single quotes: All delimiters are closed, and the content in the brackets is complete.
Double quotation marks: Some escape characters are closed, but some are retained (for example, $)
Anti-quotation marks: use it as a system command and execute it.

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.