Klaus1
21.08.07, 15:37
Hallo!
Bräuchte mal eure Hilfe zu folgendem Shell Script.
Ich bekomm einen Vergleich zweier GIF Dateien mit dem md5sum Befehl in einer IF BEDINGUNG nicht hin. Hätt schon AWK verwendet.
LOGIK sollte wie folgt funktionieren:
FALLS BILD1 != BILD2 AKTION ausführen, sonst ELSE Zweig.
Hier das Script, welches auf OPENWRT läuft:
if [ "`md5sum /tmp/voip-status/old_current.gif | awk`{print $1}``" == \
"`md5sum /tmp/voip-status/very_current.gif || awk`{print $1}``"]; then
echo "Status has not changed."
else
cp /tmp/voip-status/very_current.gif /tmp/voip-status/old_current.gif
echo "Current VoIP status has changed"
if ["`md5sum /tmp/voip-status/very_current.gif | awk`{print $1}``" == \
"`md5sum online-Voip.gif | awk`{print $1}``"]; then
echo "New status: We are online"
fi
if ["`md5sum /tmp/voip-status/very_current.gif | awk`{print $1}``" == "`md5sum offline-Voip.gif | awk`{print $1}``"]; then
echo "New status: We are offline"
fi
fi
Bräuchte mal eure Hilfe zu folgendem Shell Script.
Ich bekomm einen Vergleich zweier GIF Dateien mit dem md5sum Befehl in einer IF BEDINGUNG nicht hin. Hätt schon AWK verwendet.
LOGIK sollte wie folgt funktionieren:
FALLS BILD1 != BILD2 AKTION ausführen, sonst ELSE Zweig.
Hier das Script, welches auf OPENWRT läuft:
if [ "`md5sum /tmp/voip-status/old_current.gif | awk`{print $1}``" == \
"`md5sum /tmp/voip-status/very_current.gif || awk`{print $1}``"]; then
echo "Status has not changed."
else
cp /tmp/voip-status/very_current.gif /tmp/voip-status/old_current.gif
echo "Current VoIP status has changed"
if ["`md5sum /tmp/voip-status/very_current.gif | awk`{print $1}``" == \
"`md5sum online-Voip.gif | awk`{print $1}``"]; then
echo "New status: We are online"
fi
if ["`md5sum /tmp/voip-status/very_current.gif | awk`{print $1}``" == "`md5sum offline-Voip.gif | awk`{print $1}``"]; then
echo "New status: We are offline"
fi
fi