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

Re: globbing in scripts



On 30/11/2007, Imre Voros <voros.imre@xxxxxxxxxxxxxx> wrote:
> I would like to expand complicated filename patterns in scripts.  Like if
> the script (say s) is
>    #!/bin/zsh
>    ls $~1
> with the call
>    ./s "^f*"
> it should do the same as
>    ls ^f*
> This works fine with simpler patterns like
>    ./s "*"
> but as soon as anything more complicated appears it keeps handling $~1 as a
> string.  Strangely enough outside scripts it works fine again:
>    p="^f*"; ls $~p
> does exactly what one would expect.
>
> Am I being thick?  How can I do it?  I would be happy with either different
> calling of the script or (and?) different script, but with passing the
> pattern as a single argument.
>
> Many thanks,
>   Imre
>
> PS: Sorry if I am sending this twice.

Maybe you need to setopt extendedglob in the script?

-- 
Mikael Magnusson



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