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

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

Re: Somar último digito


From: andrelucio . fc
Subject: Re: Somar último digito
Date: 11 Jun 2018 13:34:22 -0700

Grande Mestre Júlio.

Essa solução funciona, mas infelizmente o meu linux não tem o bc.

Conseguir fazer da seguinte forma (Bagunçado mas conseguir kkkk):

#!/bin/ash

mac="40:a5:ef:7b:2b:c1"

macsufix=$(echo $mac | cut -c 16-)

macprefix=$(echo $mac | cut -c 1-15)

hexsufix=$(printf "%d\n" 0x$macsufix)

soma=$(expr $hexsufix + 1)

octultimo=$(printf "%x\n" $soma)

printf "%s:%s\n" "$mac" "$octultimo" 



reply via email to

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