Halöchen,
also so sieht mein derzeitiger Forschungsstand aus
Code
for var in $TMP/wtmp*
do
LOGIN=$(last -F -f $var | grep $2 | cut -c 44-63)
LOGOUT=$(last -F -f $var | grep $2 | cut -c 71-90)
while read -r line
do
LITIME=$(date -d "$line" +%s)
done <<< "$LOGIN"
echo $LITIME
while read -r line2
do
LOTIME=$(date -d "$line2" +%s)
done <<< "$LOGOUT"
echo $LOTIME
let total${count}=$LOTIME-$LITIME
echo "toal= $total$count" #Also bei der Variante kommt nichts gescheites raus
echo "total= $total" #Hier kommt nichts (leeres Feld nach dem = )
echo "total= $total${count}" #War ja klar dass das nicht Funktioniert
#Zähler um eins erhöhen
count=$((count + 1))
done
Alles anzeigen
Mein Problem ist jetzt wie man sieht, die Variable total auzugeben. Also ich denke mal so wie ich das jetzt zusammengeschrieben habe, mit total${count} hoffe ich das er die variable um eins Zählt also das es eine total1, total2, ...,totaln gibt
Wie gebe ich diese aber wieder aus