Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: turn off globbing sometimes



>  On 6/26/07, Richard Hartmann <richih.mailinglist@xxxxxxxxx> wrote:
> >
> >
> > > alias command="noglob command"
> >
> > How could I turn globbing off for the _remote_ part of scp?
> >
> > I.e.
> > scp remote:foo/* .
> > should not expand, while
> > scp * remote:foo/
> > should expand normally. Any ideas?


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}"
}

There's probably a way to inline the ~ GLOB_SUBST enabling only on
elements of an array matching a pattern, whilst leaving the array
element ordering unmutated.

Regards,
-Phil



Messages sorted by: Reverse Date, Date, Thread, Author