12

I have switched over to zsh, and it is working fine. One strange thing, when I try to scp with a * wildcard, it does not work, and I have to drop into bash. The second command below works fine.

Any ideas on why this would be and how to fix it?

~/dmp ⌚ 16:06:10
$ scp abc@123:/home/se/exports/201405091107/* .
zsh: no matches found: root@uf3:/home/se/exports/201405091107/*

~/dmp ⌚ 16:06:53
$ bash 
sean@seanlaptop:~/dmp$ scp abc@123:/home/se/exports/201405091107/* .
16

Bash and Zsh have different default behavior when it comes to failed globbing.

In bash, if a glob doesn't match anything, you get back the unmodified glob you used. In zsh this throws an error instead.

Thus you need to quote it.

scp 'abc@123:/home/se/exports/201405091107/*' .

If you want to get the same behavior as bash, you can do the following

setopt nonomatch
0

Checkout this answer at https://superuser.com/a/740728/978073

For zprezto users, prepending the command with backslash works!

Replace,

$ scp <command>

with

$ \scp <command>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.