14,959
edits
| Line 181: | Line 181: | ||
== How to resolve the error: no matches found == | == How to resolve the error: no matches found == | ||
Error condition | '''Error condition''' | ||
* When I executed the Curl command {{kbd | key=<nowiki>curl http://website.test/http_status.php?case=500</nowiki>}}, but I met the error message: "zsh: no matches found: <nowiki>http://website.test/http_status.php?case=500</nowiki>" | * When I executed the Curl command {{kbd | key=<nowiki>curl http://website.test/http_status.php?case=500</nowiki>}}, but I met the error message: "zsh: no matches found: <nowiki>http://website.test/http_status.php?case=500</nowiki>" | ||
Solution<ref>[https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E7%82%BA%E4%BB%80%E9%BA%BC-mac-terminal-curl-%E6%8C%87%E4%BB%A4%E7%9A%84%E7%B6%B2%E5%9D%80%E9%80%9A%E5%B8%B8%E8%A6%81%E5%8A%A0%E9%9B%99%E5%BC%95%E8%99%9F-8c3e9227be34 為什麼 Mac terminal curl 指令的網址通常要加雙引號 - 彼得潘的 Swift iOS App 開發問題解答集 - Medium]</ref> | '''Solution'''<ref>[https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E7%82%BA%E4%BB%80%E9%BA%BC-mac-terminal-curl-%E6%8C%87%E4%BB%A4%E7%9A%84%E7%B6%B2%E5%9D%80%E9%80%9A%E5%B8%B8%E8%A6%81%E5%8A%A0%E9%9B%99%E5%BC%95%E8%99%9F-8c3e9227be34 為什麼 Mac terminal curl 指令的網址通常要加雙引號 - 彼得潘的 Swift iOS App 開發問題解答集 - Medium]</ref> | ||
* Double quote the {{kbd | key=<nowiki>URL</nowiki>}} e.g. {{kbd | key=<nowiki>curl "http://website.test/http_status.php?case=500"</nowiki>}} | * Double quote the {{kbd | key=<nowiki>URL</nowiki>}} e.g. {{kbd | key=<nowiki>curl "http://website.test/http_status.php?case=500"</nowiki>}} | ||
'''Explanation''' by Claude | |||
When you see a "no matches found" error in zsh (a type of shell), it's because the shell gets confused by special characters in your command. The main problem is the question mark (?) in the URL. | |||
In a shell, some characters do special jobs: | |||
* ? means "any one character" | |||
* * means "any set of characters" | |||
* [] is for grouping characters | |||
* {} is for making lists of items | |||
Here's what happens: | |||
# When you run curl without quotes, the shell sees the ? and thinks "I need to find a file that matches this pattern" | |||
# It looks in your current folder for matching files | |||
# It can't find any files, so it shows the error | |||
The fix is simple: put double quotes ("") around your URL. This tells the shell "just use these characters exactly as they are - don't try to do anything special with them." Now the ? goes straight to curl as part of the web address, instead of being used as a special character by the shell. | |||
== How to resolve the error: Remote file name has no length == | == How to resolve the error: Remote file name has no length == | ||