shell-script-pt
[Top][All Lists]
Advanced

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

Re: Conversão de Bases em Bash


From: mop
Subject: Re: Conversão de Bases em Bash
Date: Thu, 12 Jul 2007 15:07:19 -0300

Ótimas dicas, apenas acrescentaria que, pelo menos no bash, as bases não
precisam ser exclusivamente potências inteiras de 2.

web@k7/tmp$ n=R1s; for b in `seq 56 99`;do echo n=$n bd=$b vd=$[$b#$n];done
n=R1s bd=56 vd=166292
n=R1s bd=57 vd=172282
n=R1s bd=58 vd=178378
n=R1s bd=59 vd=184580
n=R1s bd=60 vd=190888
n=R1s bd=61 vd=197302
n=R1s bd=62 vd=203822
n=R1s bd=63 vd=210448
n=R1s bd=64 vd=217180
bash: 65#R1s: invalid arithmetic base (error token is "65#R1s")
web@k7/tmp$ 

Obs.: colunas 2 e 3 com valores em decimal:



reply via email to

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