当我通过 zsh 尝试 scp 时,我得到
scp hostA:Descargas/debian-6.0.4-* user@192.168.1.154:Escritorio/Software/
zsh: no matches found: hostA:Descargas/debian-6.0.4-*
Run Code Online (Sandbox Code Playgroud)
相同的命令在 bash 中工作
yPh*_*hil 134
转义通配符:
scp hostA:Descargas/debian-6.0.4-\*
Run Code Online (Sandbox Code Playgroud)
小智 8
聚会太晚了,但是..
你也可以用引号转义字符串
scp "hostA:Descargas/debian-6.0.4-*" "user@192.168.1.154:Escritorio/Software/"
Run Code Online (Sandbox Code Playgroud)
这篇文章有一个很好的解决方案,通过使用 url-quote-magic 插件自动转义 scp 命令中的 glob。要启用它,请将以下内容添加到您的~/.zshrc:
# Automatically quote globs in URL and remote references
__remote_commands=(scp rsync)
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
zstyle -e :urlglobber url-other-schema '[[ $__remote_commands[(i)$words[1]] -le ${#__remote_commands} ]] && reply=("*") || reply=(http https ftp)'
Run Code Online (Sandbox Code Playgroud)
当您在 scp 或 rsync 命令中键入 glob 字符(例如*)作为远程路径的一部分时,zsh 会自动在前面添加一个黑斜杠,如下所示:
scp hostA:Descargas/debian-6.0.4-\* user@192.168.1.154:Escritorio/Software/
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
54736 次 |
| 最近记录: |