Shell interprets variable wildcard characters to execute

Source: Internet
Author: User

Recently, in the shell, I tried to invoke MySQL's query results, but there was a surprising result.

This is the table data in MySQL

A SQL statement is stored in this table to separate the statement from the shell for execution.

Execution results are not consistent with the results of the SQL query as expected

And there was this strange result.

Carefully analyze the results in the diagram, the SQL statements stored in the Lenovo table are select * from Testsql;

It seems that "*" is missing, and then looking at other things, and finding the same list of files in the current directory

Is it that the "*" in the result of the query is interpreted as a wildcard?

So I changed the shell script and added double quotation marks to the output to prohibit the interpretation of wildcard characters.

Note the double quotation marks at the label

Execute the script again

You get the effect you want.

This kind of problem only comes into contact with the shell at first. The Great God Gate can be omitted ...

Shell interprets variable wildcard characters to execute

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.