#!/bin/bash # lese Bruttosumme aus DB dbbrutto=$(mysql -umlohn -pmlohn -N mlohn <<<"select sum(brutto) from lohnabrechnung where monat like '2014__' and ma_id=1;") echo "Bruttogehalt (DB): $dbbrutto" # auf ganze Zahl abschneiden dbbrutto=${dbbrutto%%.*} abbrutto=$(grep Brutto /var/mlohn/print/Gehalt_WagnerMichael.txt) abbrutto=${abbrutto##* } echo "Bruttogehalt (Abrechnung): $abbrutto" abbrutto=${abbrutto%%.*} if [ "$dbbrutto" -eq "$abbrutto" ] then echo "Berechnung stimmt" exit 0 fi echo "Berechnung stimmt nicht" exit 1