BitShares Forum

Main => General Discussion => Topic started by: merockstar on November 26, 2014, 12:36:35 pm

Title: a script for wallet_check_sharedrop results
Post by: merockstar on November 26, 2014, 12:36:35 pm
someone wrote this bash script for me and I found it useful. I'm not much of a programmer but it looks alright to me, can anyone confirm? just replace INSERTPASTEBINURLHERE with the url of a pastebin of your wallet_check_sharedrop results

Code: [Select]
    #!/bin/bash
     
    sum=0;
     
    while read bal
    do
            sum=sum+$bal;
    done <<< `wget -q -O- INSERTPASTEBINURLHERE | grep original_balance | cut -d ":" -f2 | tr -d " "`
     
    echo $sum

Title: Re: a script for wallet_check_sharedrop results
Post by: xeroc on November 26, 2014, 12:40:43 pm
Not sure with the bash syntax .. but i can confirm it's safe to run ..

Quote
Code: [Select]
    #!/bin/bash
     
    sum=0;
     
    while read bal
    do
            sum=sum+$bal;
    done <<< `wget -q -O- INSERTPASTEBINURLHERE | grep original_balance | cut -d ":" -f2 | tr -d " "`
     
    echo $sum

Title: Re: a script for wallet_check_sharedrop results
Post by: pc on November 26, 2014, 12:50:53 pm
Code: [Select]
            sum=sum+$bal;

That should be

Code: [Select]
            sum=$(($sum + $bal))

instead.
Title: Re: a script for wallet_check_sharedrop results
Post by: merockstar on November 26, 2014, 12:56:00 pm
Code: [Select]
            sum=sum+$bal;

That should be

Code: [Select]
            sum=$(($sum + $bal))

instead.

done.

but I got this

Code: [Select]
")02326245rror: invalid arithmetic operator (error token is "
0


so I'm going to switch it back.
Title: Re: a script for wallet_check_sharedrop results
Post by: arubi on November 26, 2014, 02:09:23 pm
Actually I wrote the script :P
Feel free to "bash" my scripting skills!
Title: Re: a script for wallet_check_sharedrop results
Post by: pc on November 26, 2014, 02:18:52 pm

but I got this

Code: [Select]
")02326245rror: invalid arithmetic operator (error token is "
0


so I'm going to switch it back.

The error message is an indication that it's actually trying to calculate, which it wasn't before the change. Something's wrong with your input data.

(The whole pastebin / wget part is unnecessarily complicated IMO. Leave out the '<<< ... wget ... rest of the line...' part and c&p the output of wallet_check_sharedrop directly into the input.)
Title: Re: a script for wallet_check_sharedrop results
Post by: arubi on November 26, 2014, 02:42:55 pm

but I got this

Code: [Select]
")02326245rror: invalid arithmetic operator (error token is "
0


so I'm going to switch it back.

The error message is an indication that it's actually trying to calculate, which it wasn't before the change. Something's wrong with your input data.

(The whole pastebin / wget part is unnecessarily complicated IMO. Leave out the '<<< ... wget ... rest of the line...' part and c&p the output of wallet_check_sharedrop directly into the input.)

The reason the whole wget ... part is there is because I wrote this for myself while trying to help out merockstar on irc.
I I know it's not written well. I did it at like 4 in the morning :(
Title: Re: a script for wallet_check_sharedrop results
Post by: merockstar on November 27, 2014, 02:10:54 pm

but I got this

Code: [Select]
")02326245rror: invalid arithmetic operator (error token is "
0


so I'm going to switch it back.

The error message is an indication that it's actually trying to calculate, which it wasn't before the change. Something's wrong with your input data.

(The whole pastebin / wget part is unnecessarily complicated IMO. Leave out the '<<< ... wget ... rest of the line...' part and c&p the output of wallet_check_sharedrop directly into the input.)

The reason the whole wget ... part is there is because I wrote this for myself while trying to help out merockstar on irc.
I I know it's not written well. I did it at like 4 in the morning :(

i appreciated the effort as well arubi. wanted to credit you but couldn't remember your name :P

pc, thanks for helping make it better, I'll give the direct copy/paste a try. Is the result I'm getting from the original wget arubi version of the script invalid then?