[prog] bash script - mac address compare and send email
Chris Henderson
henders254 at gmail.com
Tue Mar 24 02:34:05 UTC 2009
I'm trying to write a script that will compare MAC address and send
out an email. But it's not working as expected. I have tried both
"-eq" and "==" - but guess the problem is somewhere else. I want to
run this program in the background (with &)
Thanks for any help.
#!/bin/bash
set -x
MAC_AS_READ_FROM_TSHARK=$(tshark -i eth0 -n port 68 -R 'bootp.type ==
2' -o column.format:'"Source MAC","%hs"')
MAC1="00:1F:32:6D:BB"
if [ "$MAC_AS_READ_FROM_TSHARK" -eq "$MAC1" ]; then
echo "foo" | mail -s "foo" foo at bar
fi
More information about the Programming
mailing list