Article Source: http://zhousir1991.diandian.com/page/4
[Root @ My ~] # Find.-Name *. rpm
/Nessus-4.0.1-es5.i386.rpm
[Root @ My ~] # Find.-Name * .tar.gz
Find: paths must precede expression: recordmydesktop-0.3.8.1.tar.gz
Usage: find [-H] [-L] [-p] [-olevel] [-D help | tree | search | stat | rates | opt | exec] [path...] [expression]
[Root @ My ~] # Find.-Name '* .tar.gz'
/Gtk-recordmydesktop-0.3.8.tar.gz
/Recordmydesktop-0.3.8.1.tar.gz
The above are my problems,Solve the problem after single quotation marks are added: You can find relevant information on the Internet to solve this problem. For copyright issues, please contact me!
In find/-name MySQL *, the-name parameter is not the actual MySQL *, but the shell first parses msyql *. If the file name or directory name starting with MySQL can be found in the current directory, pass the matched file name or directory name as the name parameter to it in the following three cases:
1. If no matching shell exists, pass MySQL * to find;
2. If only one of them is matched, the find command will be executed normally, but the result is incorrect. For example, if the current directory only has one directory or file named mysqla, shell will pass mysqla as the name parameter to find, then run the command;
3. If multiple matches are found, an error is returned. The error message is as follows:
Find: paths must precede expression
Usage: Find [-H] [-L] [-p] [path...] [expression]
That is to say, when multiple files or directories are matched, shell will pass all the matched files or directories as the name parameter to find, which causes the find operation to fail. For example, the current directory has mysqla
In mysqlb, the command line after shell matching is find/-name mysqla mysqlb, so that find cannot be executed normally.
And find/-name "MySQL *", shell will not parse the MySQL * expression, directly pass MySQL * To find, find will be executed normally, and get the desired result.
Conclusion: in the future, we should strive for rigor in Shell usage!