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

Re: How to overcome the (a/b/c…)(N) pattern limitation?



2020-04-18 15:41:37 +0200, Sebastian Gniazdowski:
> On Sat, 18 Apr 2020 at 14:56, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
> wrote:
> 
> > On Sat, Apr 18, 2020 at 2:51 PM Sebastian Gniazdowski
> > <sgniazdowski@xxxxxxxxx> wrote:
> > > I was trying to do: ls (/tmp/somedir/gh|./gh)(N)
> >
> > This should work:
> >
> >   ls {/tmp/somedir/gh,./gh}(N)
> >
> > Note that you'll get listing for the current directory if there are no
> > matches.
> >
> > Roman.
> >
> 
> I need the technique to be pattern-based – it is used in script in a
> $~pattern way.
[...]

Use an array:

pattern=({/tmp/somedir/gh,./gh}'(N)')
ls -ld -- $~pattern

-- 
Stephane



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