On Tue, Feb 11, 2025 at 9:37 AM microsuxx <fxmb...@gmail.com> wrote:

> 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 ..
>

I cut/pasted as is your code
$ 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" ; }
$

Then I run it with
$ echo $BASH_VERSION
5.2.21(1)-release
$ shopt
autocd         off
assoc_expand_once off
cdable_vars     off
cdspell         off
checkhash       off
checkjobs       off
checkwinsize   on
cmdhist         on
compat31       off
compat32       off
compat40       off
compat41       off
compat42       off
compat43       off
compat44       off
complete_fullquote on
direxpand       off
dirspell       off
dotglob         off
execfail       off
expand_aliases on
extdebug       off
extglob         off
extquote       on
failglob       off
force_fignore   on
globasciiranges on
globskipdots   on
globstar       on
gnu_errfmt     off
histappend     off
histreedit     off
histverify     off
hostcomplete   on
huponexit       off
inherit_errexit off
interactive_comments on
lastpipe       off
lithist         on
localvar_inherit off
localvar_unset off
login_shell     off
mailwarn       off
no_empty_cmd_completion off
nocaseglob     off
nocasematch     off
noexpand_translation off
nullglob       off
patsub_replacement on
progcomp       on
progcomp_alias off
promptvars     on
restricted_shell off
shift_verbose   off
sourcepath     on
varredir_close off
xpg_echo       off

And got this

$ gimme_num 0x10 60#yo 0x10
0x10xx60xx0x10xx$

Reply via email to