Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

This command works fine in bash:

bash-3.2$ scp luna4:/u/paige/maye/src/diviner/notebooks/plots/hk_* .
hk_az.png                                                   100%  126KB 126.0KB/s   00:00
hk_baffle.png                                               100%  166KB 166.3KB/s   00:01
hk_bb.png                                                   100%  144KB 143.8KB/s   00:00
hk_el.png                                                   100%  115KB 115.3KB/s   00:00
hk_fpa.png                                                  100%  123KB 123.2KB/s   00:00
hk_fpb.png                                                  100%  126KB 125.7KB/s   00:00
hk_hybrid.png                                               100%   99KB  98.7KB/s   00:00
hk_oba.png                                                  100%  140KB 139.7KB/s   00:00
hk_solar.png                                                100%  206KB 205.6KB/s   00:00
hk_temp.png                                                 100%   62KB  61.8KB/s   00:00
hk_yoke.png                                                 100%  122KB 121.7KB/s   00:00
bash-3.2$ exit

but in zsh it fails, no files are found:

$ scp luna4:/u/paige/maye/src/diviner/notebooks/plots/hk_* .
zsh: no matches found: luna4:/u/paige/maye/src/diviner/notebooks/plots/hk_*

What is going wrong?

share|improve this question

migrated from stackoverflow.com Dec 29 '13 at 8:07

This question came from our site for professional and enthusiast programmers.

    
I was wondering myself if it's okay for this to post here, but I searched for zsh and scp and found many entries, none of which marked as 'on hold', otherwise I wouldn't have posted it here. –  K.-Michael Aye Dec 22 '13 at 10:41

1 Answer 1

up vote 6 down vote accepted

The problem is that zsh is globbing the remote path. You can verify this by

scp luna4:"/u/paige/maye/src/diviner/notebooks/plots/hk_*" .

To turn globbing off for scp remote paths, but otherwise leave globbing the same (from here) add this to your .zshrc -

# Disable globbing on the remote path.
alias scp='noglob scp_wrap'
function scp_wrap {
  local -a args
  local i
  for i in "$@"; do case $i in
    (*:*) args+=($i) ;;
    (*) args+=(${~i}) ;;
  esac; done
  command scp "${(@)args}"
}
share|improve this answer
    
Cheers. Confirmed. Can I switch that off? –  K.-Michael Aye Dec 20 '13 at 19:46
1  
@K.-MichaelAye Edited answer, but yes. –  Elliott Frisch Dec 20 '13 at 19:48
    
And that hack also works. Great, thanks! (Added it to my .zshrc) –  K.-Michael Aye Dec 20 '13 at 19:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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