walletsBalance.sh: Clean output format in array, tmp output
This commit is contained in:
parent
4da8bae7fa
commit
bb00097c93
|
@ -16,15 +16,20 @@ work() {
|
||||||
balance=$(silkaj -p $node balance $i 2>/dev/null)
|
balance=$(silkaj -p $node balance $i 2>/dev/null)
|
||||||
}
|
}
|
||||||
exec
|
exec
|
||||||
while [[ $? == 1 ]]; do echo "Erreur $i $k" | tee -a silkaj_error.log; ((k++)); exec; done
|
while [[ $? == 1 ]]; do echo "Erreur $k: $i" | tee -a silkaj_error.log; ((k++)); exec; done
|
||||||
unset k
|
unset k
|
||||||
balance=$(awk '/Total Quantitative =/ { print $4 }' <<<"$balance")
|
balance=$(awk '/Total Quantitative =/ { print $4 }' <<<"$balance")
|
||||||
|
|
||||||
[[ $1 == "members" ]] && username=$(curl -m 20 -s $DUNITER/wot/members | jq -r --arg pubkey "$i" '.results[] | select(.pubkey==$pubkey) | .uid')
|
if [[ $1 == "members" ]]; then
|
||||||
formatedBalance="$balance"$'\t'"$i"
|
username=$(curl -m 20 -s $DUNITER/wot/members | jq -r --arg pubkey "$i" '.results[] | select(.pubkey==$pubkey) | .uid')
|
||||||
[[ $username ]] && formatedBalance="$formatedBalance"$'\t'"$username"
|
formatedBalance=$(printf "%-10s | %-45s | %-1s" $balance $i $username)
|
||||||
unset username
|
unset username
|
||||||
echo "$formatedBalance"
|
else
|
||||||
|
formatedBalance=$(printf "%-10s | %-45s" $balance $i)
|
||||||
|
fi
|
||||||
|
unset balance
|
||||||
|
|
||||||
|
echo "$formatedBalance" | tee -a /tmp/balance-g1.txt
|
||||||
|
|
||||||
totalBalance="$totalBalance"$'\n'"$formatedBalance"
|
totalBalance="$totalBalance"$'\n'"$formatedBalance"
|
||||||
|
|
||||||
|
@ -42,4 +47,5 @@ wallets=$(cat $WEBPATH/data/wallets-g1-simple.txt 2>/dev/null)
|
||||||
work && unset wallets
|
work && unset wallets
|
||||||
|
|
||||||
totalBalance=$(sort -nr <<<$totalBalance)
|
totalBalance=$(sort -nr <<<$totalBalance)
|
||||||
grep . <<<"$totalBalance" > $GPATH/db/wallets_balance.txt
|
[[ ! -d $GPATH/db ]] && mkdir $GPATH/db
|
||||||
|
grep . <<<"$totalBalance" > $GPATH/db/wallets_balance.txt && rm /tmp/balance-g1.txt
|
||||||
|
|
Loading…
Reference in New Issue