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