#!/bin/sh pi=$(ping -c 5 8.8.8.8 -i 0.5 | grep received | cut -f2 -d"," | cut -f2 -d" ") case "$pi" in 5) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=100" ;; 4) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=80" ;; 3) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=60" ;; 2) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=40" ;; 1) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=20" ;; *) curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=23&nvalue=0&svalue=0" ;; esac