Shell Learning Note (2) Replace command • • The difference from ()

Source: Internet
Author: User

· CMD in the execution of the shell regardless of · What is the content of, advanced interpretation, and then the interpretation of the final results to the shell, if the result of interpretation is not the shell can command, will be error. However, only the execution results of CMD are output as text, there is no problem.

Such as:
[Email protected] root]# i=0
[Email protected] root]# name=pwd
[[Email protected] root]# ' $i ' # $i have obtained the result 0, and then give 0 to the shell execution, of course, error
-bash:0: Command not found
[[Email protected] root]# ' $name ' # $name has been equivalent to the implementation of the PWD, get/root, at this time/root to shell execution, of course, can not explain
-bash:/root:is a directory
[[email protected] root]# echo "' $name '" # to output the contents of $name after execution as text
/root
[[Email protected] root]# ' pwd '
-bash:/root:is a directory

(cmd) at execution, if CMD is a command, then directly to the shell to execute, if the variable value, then only the first layer of the literal interpretation of the shell is dropped

Such as:
[Email protected] root]# i=0
[Email protected] root]# name=pwd
[[Email protected] root]# ($i) # after explaining to get 0, and then give 0 to the shell, of course, error.
-bash:0: Command not found
[[Email protected] root]# ($name) # after explaining to get PWD, then send pwd to shell execution.
/root
[[Email protected] root]# (PWD) # Just throw the PWD to the shell to execute
/root

Shell Learning Note (2) Replace command • • The difference from ()

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.