[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expand existing file system entries in one declare
From: |
alex xmb ratchev |
Subject: |
Re: expand existing file system entries in one declare |
Date: |
Sat, 4 Mar 2023 18:02:38 +0100 |
On Sat, Mar 4, 2023, 5:21 PM Greg Wooledge <greg@wooledge.org> wrote:
> On Sat, Mar 04, 2023 at 11:02:56AM +0100, alex xmb ratchev wrote:
> > in array= (
> > @(){<list,list>}
> > ) # the entries are @Q escaped
>
> That isn't the correct syntax for an extended glob which expands to
> either of two patterns. You want this instead:
>
> array=(
> @(list|list)
> )
>
IFS=,
declare -a "paths=( @(){${*@Q}} )"
to
IFS=\|
declare -a "paths=( @(${*@Q}) )"
IFS=$' \t\n'
and some code simplification
thanks mate ..
> ) # the entries are @Q escaped
>
> What does that mean?
>
> > i couldnt make ${*:2@Q} work
>
> What is that even trying to do? Create a new pseudo-list encased in a
> string which can be used by 'eval'? If so... WHY?!
>
> If you just want "all except the first", it would be so much clearner to
> store them in an array:
>
> therest=( "${@:2}" )
>
> Or, simply use "shift" if you no longer need "$1" any longer.
>
>