Search code examples
zshglobscp

what is the first step of ssh copy execute in terminal?


I am using this command to copy file from remote server to local machine:

scp -r app:/home/dolphin/model* .

In bash it works fine.In zsh it throw this error:zsh: no matches found: app:/home/dolphin/model*.I am searching from Google and understand the bash and zsh have different rule of glob.Here is my question:

  • what is the execute step detail of this command?

  • anyone could tell me the shell how to execute the command,the first step is echo the path of this command?

I could use -v(verbose) to see the scp execute process.


Solution

  • I am unfamiliar with Zsh, but as far as I can say, Bash will pass the original string to the program as an argument if nothing is globbed, while it appears that Zsh complains in this case.

    To ensure the "unglobbed" string is passed as an argument to scp(1), you can escape the asterisk:

    scp -r app:/home/dolphin/model\* .
                                  ^^