Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: noglob + find
On Tue, 12 Oct 2010 15:09:18 -0400 (EDT)
"Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:
> alias find='noglob find'
>
> $ find /tmp/tmp.* -name *.c -mtime -1
> find `/tmp/tmp.*': No such file or directory
>
> Is there a nice way to specify 'noglob'-like behavior for the arguments
> after the first dashed argument?
You have to do it other way round: expand the bits you did want globbing
after all.
alias find='noglob find'
'find'() { command find ${~1} "${(@)argv[2,-1]}"; }
(working around all the usual exciting interactions between functions and aliases)
which you can make smarter, to find the first argument with a -.
'find'() {
integer i=${argv[(i)-*]}
command find ${~argv[1,i-1]} "${(@)argv[i,-1]}"
}
is the first-pass version.
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author