#! /bin/bash
# name mac ip_or_broadcast
list=(
'win 11-22-33-44-55-66 192.168.0.255'
)
wakeonlan() {
local mac="$1"
local ip="$2"
echo "wake $2"
echo -n $mac | sed 's/[-:]//g; s/.*/FFFFFFFFFFFF&&&&&&&&&&&&&&&&/' | xxd -r -p | nc -nuw 1 $ip 7
exit 0
}
for l in "${list[@]}"; do
li=($l)
[ x$1 = x${li[0]} ] && wakeonlan "${li[1]}" "${li[2]}"
done
echo "unknown: $1"