1#!/bin/sh 2 3STATE=$1 4shift 5OPER=$* 6 7play() 8{ 9 canberra-gtk-play --file=$1 & 10} 11 12 13if [ "$STATE" = "START" ]; then 14 zenity --title="NFC operation" --info --text="$OPER" & 15 echo $! > nfc-status.pid 16 play /usr/share/sounds/ubuntu/stereo/system-ready.ogg 17 #espeak "NFC $OPER" 18fi 19 20if [ "$STATE" = "SUCCESS" -o "$STATE" = "FAIL" ]; then 21 if [ -r nfc-status.pid ]; then 22 pid=`cat nfc-status.pid` 23 rm nfc-status.pid 24 if [ $pid -gt 0 ]; then 25 if ps -o command $pid | grep -q zenity; then 26 kill $pid 27 fi 28 fi 29 fi 30fi 31 32if [ "$STATE" = "SUCCESS" ]; then 33 play /usr/share/sounds/freedesktop/stereo/complete.oga 34 #espeak "Success" 35fi 36 37if [ "$STATE" = "FAIL" ]; then 38 play /usr/share/sounds/freedesktop/stereo/bell.oga 39 #espeak "Failed" 40fi 41