Find: paths must precede expression usage: Find [-H] [-L] [-p] [path...] [expression]

Source: Internet
Author: User

When running the script today, the following error is reported:

Find: paths must precede expression
Usage: Find [-H] [-L] [-p] [path...] [expression]

Then I checked the results online and found an article, which is probably like this:You need to add single quotation marks when searching multiple files.

I used double quotation marks all the time, and I have not encountered any problems. This time I reported an error ~

SSH $ IP "CD $ path; find.-Name'Access. $ month *. Log'-Print-exec zip-r access.w.month.zip
{}\;"

ModifySingle quotesAfter that, I will see you again and report an error ~

Example:

 
# Create four text files in the tmp directory # cd/tmp # touch keys, and 42.16.txt # Find.-Name *. txtfind: paths must precede expression: 2.txt

This prompt is displayed because the asterisk is expanded to all files in the current directory. Such a match will certainly fail. Now you can see:

 
# Echo * 1.txt 2.txt 3.txt 4.txt# echo '* # echo \**

If you want the asterisk to be unexpanded, you need to add it.Parentheses or backslash escapeAnd then we will know how to find them.

 
# Find. -name '*. TXT 'Find. -name '*. TXT '. /4.txt. /2.txt. /3.txt. /1.txt# or use the backslash find. -Name \*. TXT. /4.txt. /2.txt. /3.txt. /1.txt

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.