@ -26,17 +26,20 @@ function run {
if [ -z " $toot " ]
if [ -z " $toot " ]
then echo "Toot no valido"
then echo "Toot no valido"
else
else
#toot thread "$not"
walkerName = $( toot thread " $not " --no-color | head -2 | tail -1 | cut -d "@" -f 2,3 | cut -d " " -f 1)
walkerName = $( toot thread " $not " --no-color | head -2 | tail -1 | cut -d "@" -f 2,3 | cut -d " " -f 1)
walkerDate = $( toot thread " $not " --no-color | head -2 | tail -1 | cut -d "@" -f 2,3 | rev | cut -d " " -f 1,2 | rev)
walkerDate = $( toot thread " $not " --no-color | head -2 | tail -1 | cut -d "@" -f 2,3 | rev | cut -d " " -f 1,2 | rev)
walkerFile = $( echo " $scriptDir /walkers/ $walkerName " )
walkerFile = $( echo " $scriptDir /walkers/ $walkerName " )
walkerKm = 3
walkerKm = $( toot thread " $not " --no-color | grep -i "@caminosantiago añade " | grep -i "km" | head -1 | tr " " "_" | rev | cut -d "_" -f 1 | rev | tr '[:upper:]' '[:lower:]' | sed 's/km//g' )
walkerKM = $( echo $walkerKM | sed 's/[^0-9]*//g' ) # Remove all non-numeric characters
if ! [ [ $walkerKm = ~ '^[0-9]+$' ] ] ; then
if [ -f " $walkerFile " ] ; then
if [ -f " $walkerFile " ] ; then
walkerDate2 = $( cat $walkerFile | grep " $walkerDate " | head -1 )
walkerDate2 = $( cat $walkerFile | grep " $walkerDate " | wc -l )
if [ -z " $walkerDate2 " ] ; then
if [ [ $walkerDate2 = = 0 ] ] ; then
echo " Nuevo kilometraje de $walkerName "
echo " Nuevo kilometraje de $walkerName "
echo " $walkerDate ; $walkerKm " >> $walkerFile
echo " $walkerDate ; $walkerKm " >> $walkerFile
walkerTotal = $( cat $walkerFile | cut -d ";" -f 2 | tr "\n" "+" | rev | cut -d "+" -f 2-9999 | bc)
toot post -r " $not " -m mapa.jpg -d "mapa desde Irun a Santiago. Ruta conocida como el camino del norte" " @ $walkerName Llevas caminados $walkerTotal kilometros en total. Son 824Km el Camino del Norte #fedicaminodesantiago "
else
else
echo "Toot ya añadido previamente"
echo "Toot ya añadido previamente"
fi
fi
@ -44,6 +47,11 @@ function run {
touch $walkerFile
touch $walkerFile
echo " Primer kilometraje de $walkerName "
echo " Primer kilometraje de $walkerName "
echo " $walkerDate ; $walkerKm " > $walkerFile
echo " $walkerDate ; $walkerKm " > $walkerFile
walkerTotal = $( cat $walkerFile | cut -d ";" -f 2 | tr "\n" "+" | rev | cut -d "+" -f 2-9999 | bc)
toot post -r " $not " -m mapa.jpg -d "mapa desde Irun a Santiago. Ruta conocida como el camino del norte" " Bienvenido/a/e @ $walkerName al #fedicaminodesantiago. Llevas caminados $walkerTotal kilometros. Son 824Km el Camino del Norte #newWalkerCaminoSantiago "
fi
else
echo "Toot no valido: Km value Not a number"
fi
fi
fi
fi
done < $fileNotifications
done < $fileNotifications