2007: J F M A M J J A S O N D
2008: J F M A M J J A S O N D
2009: J F M A M J J A S O N D
2010: J F M A M J J A S O N D
2011: J F M A M J J A S O N D
2012: J F M A M J J A S O N D

ZSH and scp/rsync globbing

from 2010/05/25

I finally got annoyed at typing

tjohnson> scp tcj:*txt .
zsh: no matches found: tcj:*txt

I’d always fixed this by the up-CTRL-A-over-over-over-over-quote-CTRL-E-over-over-quote method, ie

tjohnson> scp "tcj:*txt" .

but the more proper and less annoying version is

tjohnson> scp tcj:\*txt .

However, in the spirit of inspired overkill, there are a couple other options. You can define some new aliases with

alias scp='noglob scp'

but that hardly counts as overkill, so instead I edited my .zshrc to include

autoload -U url-quote-magic
zle -N self-insert url-quote-magic
zstyle -e :urlglobber url-other-schema \
'[[ $words[1] == scp ]] && reply=("*") || reply=(http https ftp)'

Now, as I type scp tcj:* it replaces it with \*, negating the problem. Also, this fixes the problem where

wget http://traviscj.com/dynpage.php?var=1&importantvar=zyzyx

interprets the & as a ‘background this command’ and throws a couple of errors. Nice!

older newer

Powered by Olark