bug-bash
[Top][All Lists]
Advanced

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

Re: "printf %d ''" should diagnose the empty string


From: microsuxx
Subject: Re: "printf %d ''" should diagnose the empty string
Date: Tue, 11 Feb 2025 09:37:41 +0100

On Tue, Feb 11, 2025, 7:13 AM Phi Debian <phi.debian@gmail.com> wrote:

>
>
> On Mon, Feb 10, 2025 at 11:46 PM microsuxx <fxmbsw7@gmail.com> wrote:
>
>> a bit unrelated .. cheap numbers filter ..
>>
>> gimme_num( ) { declare -n b=BASH_REMATCH\[1] ; local o m=[0-9,.] s=$n i t
>> ;
>> t="(-?$m+)" ; unset -v o ; for n ; do unset -v i ; while [[ $n =~ $t ]] ;
>> do n=${n/"$b"} i= o+=$b$s ; done ; [[ -v i ]] && o+=$s ; done ; [[ -v o ]]
>> && printf %s "$o" ; }
>>
>> gimme_num ' ab3.44 cd---.99 ' cd cd 77.7.77
>>
>> 3.44
>> -.99
>>
>> 77.7.77
>>
>>
> Rejected
> $ gimme_num '0x10'
>  0x10xx
> $ gimme_num '64#yo'
> 64xx
> $ gimme_num '0x10'
> 0#yo10#yo#yo
>
> gimme_num should be renamed random_string()
>

how does it output strings .. ?
i mean i dont get ur outputs
1 it doesnt include # and @ etc
2 no hex etc yet , only numbers and dots / commas

gimme_num 0x10 60#yo 0x10
0
10

60

0
10

but i dont get ur outputs such as 0x10xx or 64xx or the other ..

>


reply via email to

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