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:02:43 +0200

rsync "${pre[@]}" "${@/#/--accept=}" "${stu[@]}"

On Sat, Jul 24, 2021 at 7:01 PM Greg Wooledge <greg@wooledge.org> wrote:
>
> On Sat, Jul 24, 2021 at 06:57:34PM +0200, dora-solomon@brusseler.com wrote:
> > Yes, it is for an rsync functionality.  I would like to gather the suffixes 
> > together as I
> >
> > will do some other checks in addition to rsync and some status logs.
>
> Showing us an example of the rsync command you want to create would be
> ideal.
>
> In the absence of that, I'll just guess that you want to receive a list
> of suffixes, such as:
>
> .c
> .h
> ,v
>
> And generate a command like this:
>
> rsync --accept="*.c" --accept="*.h" --accept="*,v"
>
> Here's how I would do it:
>
> #!/bin/bash
>
> args=()
> for arg; do
>     args+=(--accept="*$arg")
> done
>
> args+=( other rsync arguments here )
>
> rsync "${args[@]}"
>



reply via email to

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