[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 20:27:51 +0200 |
the sad thing about it, thats why its prolly so short, it only
supports stuffixes
no in path matches or prefixes etc
On Sat, Jul 24, 2021 at 8:25 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
> im all for {shortened,coding}
>
> here is my pattern6 script already
> args are 'include include include -- exclude exclude'
>
> #!/bin/bash
>
> (( ! $# )) && set -- c h -- h
>
> for arg ; do
> if [[ $arg == -- ]] ; then
> ex=
> elif [[ -v ex ]] ; then
> e+=( ${e+-o} -iname "*.$arg" )
> else
> s+=( ${s+-o } -iname "*.$arg" )
> fi
> done
>
> find . \( "${e[@]}" \) -prune -o \( "${s[@]}" \) -print
>
> On Sat, Jul 24, 2021 at 8:17 PM Greg Wooledge <greg@wooledge.org> wrote:
> >
> > On Sat, Jul 24, 2021 at 07:43:44PM +0200, dora-solomon@brusseler.com wrote:
> > > > "I have a known list of suffixes that I want to pass to rsync, and I
> > > > have been using the bash brace expansion syntax to do it, but it
> > > > doesn't work when my suffixes contain literal commas."
> > >
> > > That's it. I babbled too much.
> >
> > OK.
> >
> > > Perhaps the following and could also rewove the braces.
> > > -e{",v",.othersuffix}
> >
> > No. Simply stop using the brace expansion syntax.
> >
> > Brace expansion's *entire* purpose is to save you effort, by reducing
> > the amount of duplication you have to type. It doesn't do anything
> > else.
> >
> > It seems you've become confused, and are operating under the impression
> > that the brace expansion syntax is somehow *required*, or is being
> > interpreted by rsync. It's not. It's simply one of bash's features
> > for reducing typing.
> >
> > The moment you spend more than 30 seconds trying to figure out how to
> > work around its limitations, you've already lost. You could have spent
> > those 30 seconds typing out the command normally instead.
> >
> > rsync -i.c -i.h -e,v -e.othersuffix
> >
> > There, that's it.
> >
- Re: Passing list of filename suffixes to script., (continued)
- Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24
- Re: Passing list of filename suffixes to script., Greg Wooledge, 2021/07/24
- Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24
- Passing list of filename suffixes to script., dora-solomon, 2021/07/24
- Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24
- Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24
- Passing list of filename suffixes to script., dora-solomon, 2021/07/24
- Passing list of filename suffixes to script., dora-solomon, 2021/07/24
- Re: Passing list of filename suffixes to script., Greg Wooledge, 2021/07/24
- Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24
- Re: Passing list of filename suffixes to script.,
Alex fxmbsw7 Ratchev <=
Re: Passing list of filename suffixes to script., Alex fxmbsw7 Ratchev, 2021/07/24