Back quotes, single quotes, double quotes in the Linux Shell

Source: Internet
Author: User
Tags echo command


The anti-quote bit (') is located above the TAB key of the keyboard, to the left of the 1 key. Note the difference between the single quotation mark (') on the left side of the ENTER key.
Plays the role of command substitution in Linux. Command substitution refers to the ability of the shell to interpolate the standard output of a command anywhere on a command line.
as follows, the shell executes the date command in the anti-quotation marks and inserts the result into the content displayed by the echo command.
[Email protected] sh]# echo the date is ' date '
The date is August 7, 2016 Sunday 19:25:43 CST

Single quotes, double quotes
Single and double quotes are used for the user to assign a string with a space to the variable's delimiter.
[Email protected] sh]# str= "Today is Sunday"
[Email protected] sh]# echo $str
Today is Sunday

If there is no single or double quotation marks, the shell interprets the string after the space as a command.
[Email protected] sh]# Str=today is Sunday
Bash:is:command not found

[[email protected] sh]# testvalue=100
Span style= "Font-family:microsoft Yahei;" > [[email protected] sh]# Echo ' The TestValue is $testvalue '

[[email protected] sh]# echo "The TestValue is $testvalue"
The TestValue is.

Note: The usage of this thing, I Baidu a bit, and $ () is the same. When you execute a command, the statements in either, or $ () are executed once as a command, and the result is added to the original command for re-execution, for example:
echo ' ls '
The LS is executed first to get and so on, then replace the original command as:
The result of the final execution is
Well, usually we encounter the output of a bunch of command execution results into a variable, it needs to be enclosed in this command substitution, it is understandable.
There is another problem here, although many system engineers like to use anti-quotes to enclose the command when using the Replace function. However, according to the POSIX specification, a system engineer is required to take the form of a $ (command). So, we'd better follow this specification, less ", more than $ ()

Back quotes, single quotes, double quotes in the Linux 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: 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.