Improve json template looping in variable instead of tmp files

This commit is contained in:
poka 2020-06-18 04:29:56 +02:00
parent a9fefe0932
commit 6fa84528af
1 changed files with 2 additions and 5 deletions

View File

@ -12,13 +12,10 @@ j=1
for i in $rWallets; do
! [[ $j =~ ^(0|1)$ ]] && ((j--))
if [[ $j == 1 ]]; then
dateN=$i
cp tpl/graph.json rWallets-$i.json
sed -i s/_DATE/$i/g rWallets-$i.json
jsonTPL=$(sed s/_DATE/$i/g tpl/graph.json)
j=0
elif [[ $j == 0 ]]; then
result+=$(sed s/_RWALLET/$i/g rWallets-$dateN.json)
rm rWallets-$dateN.json
result+=$(sed s/_RWALLET/$i/g <<< $jsonTPL)
[[ $n == 1 ]] && j=1 || j=$((n*2))
fi
done