help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing list of filename suffixes to script.


From: Alex fxmbsw7 Ratchev
Subject: Re: Passing list of filename suffixes to script.
Date: Sat, 24 Jul 2021 19:01:26 +0200

yea in short its just ./*.@(ext1|ext2)

i realize now '/' can not be a filename and , but ...

On Sat, Jul 24, 2021 at 6:58 PM Greg Wooledge <greg@wooledge.org> wrote:
>
> On Sat, Jul 24, 2021 at 06:52:14PM +0200, Alex fxmbsw7 Ratchev wrote:
> > i made a script like always for it, but to my surprise it doesnt work
> >
> > ./*.xz
> > is there, but it doesnt return anything
> > from three @(..) extglobs
> > @(./)@(*.)@(xz|other)
>
> The @(./) part is wrong.  Globbing doesn't handle directory path
> components in that way.
>
> unicorn:~$ echo *.pdf
> 1040A.pdf 34282.pdf [...]
>
> unicorn:~$ echo @(./)*.pdf
> @(./)*.pdf
>
> You're basically asking bash to generate filename matches which include
> the substring "./" within the current directory.  No filename can contain
> that substring, because it has a slash in it.
>
> Also, there is absolutely no benefit to putting the "*." part inside of
> an extglob expression.  It works, but it's extra syntax for no reason.
>
> What you want is simply this:
>
> ./*.@(xz|other)
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]