diff --git a/scripts/walletsBalance.sh b/scripts/walletsBalance.sh index a9f8b87..955d394 100755 --- a/scripts/walletsBalance.sh +++ b/scripts/walletsBalance.sh @@ -12,19 +12,28 @@ node=$(cut -d '/' -f3 <<<"$DUNITER") work() { for i in $wallets; do - exec() { - balance=$($JAKLIS balance -p $i 2>/dev/null) - } - exec - while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done - unset k if [[ $1 == "members" ]]; then - username=$($JAKLIS id -p $i | jq -r .username) + exec() { + jsonResult=$($JAKLIS idBalance -p $i 2>/dev/null) + } + exec + while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done + unset k + + balance=$(echo "$jsonResult" | jq -r '.balance') + username=$(echo "$jsonResult" | jq -r '.username') formatedBalance=$(printf "%-10s | %-45s | %-1s" $balance $i $username) htmlBloc="$htmlBloc"$'\n'"$balance$i$username" unset username else + exec() { + balance=$($JAKLIS id -p $i 2>/dev/null) + } + exec + while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done + unset k + formatedBalance=$(printf "%-10s | %-45s" $balance $i) htmlBloc="$htmlBloc"$'\n'"$balance$i " fi