#!/bin/bash # Récupération du chemin absolu du répertoire du script actuel GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.." [[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env source $GPATH/.env node=$(cut -d '/' -f3 <<<"$DUNITER") #Check if ed is installed which ed || { echo "$0: Error: please install ed" >&2 ; exit 1 ; } #Check if Jaklis or silkaj is installed if [[ "$JAKLIS" ]] ; then exec() { jsonResult=$($JAKLIS idBalance -p $i) || return $? balance=$(echo "$jsonResult" | jq -r '.balance') username=$(echo "$jsonResult" | jq -r '.username') } elif which silkaj ; then exec() { balance=$(silkaj -p "$node" balance "$i") || return $? balance=$(sed -n 's,.* \([\.0-9]\+\) Ğ1.*,\1,p' <<<$balance) username=$(silkaj -p "$node" id "$i") || return $? username=$(sed -n 's,.*: \(.*\)$,\1,p' <<<$username) } else echo "$0: Error: you should use Jaklis or install silkaj." >&2 exit 1 fi work() { for i in $wallets; do ((j++)) # For tests only #(( j > 42 )) && break unset k while ! exec ; do echo "Erreur $?: retry=$((k)) wallet=$i"; ((k++ > 9999)) && break ; sleep $((RANDOM%8)) ; done formatedBalance=$(printf "%-10s | %-45s | %-1s" $balance $i $username) [[ $1 == "members" ]] && username="$username" htmlBloc="$htmlBloc