help-bash
[Top][All Lists]
Advanced

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

Re: case $var in $list) issue


From: #!microsuxx
Subject: Re: case $var in $list) issue
Date: Fri, 1 Nov 2024 18:30:26 +0100

the idea of the ext match
is ${var@Q} produces escaped strings
putting those into @( .. ) , and parsing later , seems normal

but that weird echo kills me and the code ..

greets !! ..

On Fri, Nov 1, 2024, 18:27 #!microsuxx <fxmbsw7@gmail.com> wrote:

>
>
> On Fri, Nov 1, 2024, 18:19 Zachary Santer <zsanter@gmail.com> wrote:
>
>> On Fri, Nov 1, 2024 at 12:56 PM #!microsuxx <fxmbsw7@gmail.com> wrote:
>> >
>> > On Fri, Nov 1, 2024, 17:24 Zachary Santer <zsanter@gmail.com> wrote:
>> >>
>> >> IFS='|'
>> >> if [[ one =~ ${array[*]} ]]; then
>> >>   printf 'ye\n'
>> >> fi
>> >
>> >
>> > but enables free regex parsing in arr
>> >
>> > a bit further for complicated strings :
>> > but still needs regex escaping
>> > maybe replace every char to be inside a [<here>] char class
>> >
>> > arr=( a b c ) IFS=\|
>> > arr=( "${arr[@]/#/^}" ) IFS=$' \t\n'
>> > [[ one =~ ${arr[*]/%/$} ]]
>> >
>> > plus , regex escape
>>
>> Ah, yes.
>>
>> IFS='|'
>> if [[ one =~ ${array[*]//[][}{)(.*?+|'"\]/\\&} ]]; then
>>   printf 'ye\n'
>> fi
>>
>
> i dunno this style
> (.*? means first match only , like non greedy .* ?
> since when does this work in bash
> i remember from perl at around year 2003
>
> i was speaking about
>
> shopt -s patsub_replacement
> echo ${arr[*]//?/[&]}
>
> Your clock cycles are secure.
>>
>
> lol ..
>
> Wouldn't the same thing apply to the extended pattern matching
>> operators in your case?
>>
>
> hmm i dunno where the error is there
> i showed echo $m showing weird
> declare -p looks alright
> case doesnt work
> the echo is the weird'est
>
>>


reply via email to

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