Wildcards with the zsh shell

While trying to scp some files I knew existed on the remote system, I ran into an issue using a wildcard.

Using the zsh shell and using a wildcard in scp fails:

scp tom@testbox:~/test*.txt
zsh: no matches found: tom@testbox:~/test*.txt

However, the files do exist:

ssh testbox
tom@testbox:~$ ls -l
total 8
-rw-rw-r-- 1 tom tom 15 May  7 09:27 test1.txt
-rw-rw-r-- 1 tom tom 21 May  7 09:27 test2.txt

The files exist, and I have the correct permissions, however, zsh shell doesn't work out of the box with wildcards.

To fix this:

setopt nonomatch
scp tom@testbox:~/test*.txt .
test1.txt                                     100%   15    23.1KB/s   00:00
test2.txt                                     100%   21    30.4KB/s   00:00

To make this fix permanent:

echo "setopt nonomatch" >> ~/.zshrc

References

Stack Exchange - Using wildcards in commands with zsh https://superuser.com/questions/584249/using-wildcards-in-commands-with-zsh/740728#740728