Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the no matches error of the * wildcard when zsh uses the scp command

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to solve the no matches error of the * wildcard when zsh uses the scp command". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to study and learn "how to solve the no matches error of the * wildcard when zsh uses the scp command".

After the upgrade of MacOS, zsh has become the default shell, which conforms to the trend and begins the journey of using zsh.

The following error occurred when copying multiple files remotely using scp today:

# copy all configuration files in a directory (* .conf) scp host:/xxxx/*.conf. # error is as follows # zsh: no matches found: host:/xxxx/*.conf

It is certain that this command statement will work as scheduled in bash, and such a problem should be the fault of zsh. As a veteran linux user, you can quickly see the problem: zsh tried to expand the * wildcard, but the corresponding file was not found locally, resulting in a "no matches" error.

After a personal attempt and online search, there are two solutions:

Do not let zsh expand the *; the specific methods are:

Enclose the * part in quotation marks, single and double quotation marks are meaningless. For example: scp "host:/xxxx/*.conf". Or scp 'host:/xxxx/*.conf'. You can also refer only to the part of the path, for example: scp host:'/xxxx/*.conf'.

Use a backslash to prevent zsh from escaping: scp host:/xxxx/\ * .conf.

Set the nonomatch option so that when a zsh match fails, it does not report an error and uses the original content. To do this: setopt nonomatch, then use the scp command. The recommended practice is to write it to a .zshrc file and let it take effect automatically in future use.

Referenc

The * wildcard cannot be used when zsh uses the scp command

Thank you for your reading, the above is "how to solve zsh using the scp command * wildcard no matches error" content, after the study of this article, I believe you on how to solve the zsh scp command when the * wildcard appears no matches error this problem has a more profound understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report