I'm typing this in Bash:
scp user@remote:~/dir/*.xml .
and it works, getting all the files that make the wildcard on the remote server. But why does this work? I thought that Bash expands wildcard expressions in arguments before the arguments become visible to a tool like scp
.
Best Answer
If there is no matching filename, then a wildcard expression in bash expands to itself. So, as long as you don't create any file locally whose name matches
user@remote:~/dir/*.xml
, your command works without quoting.