AOU:optimisation du code (while : , let i++ et message d'info)

This commit is contained in:
oantoine 2016-08-17 10:18:40 +02:00
parent d9fef1e417
commit 2a63bab202

View File

@ -16,25 +16,22 @@ mpc play
printf "MPC started" printf "MPC started"
i=0 i=0
echo "Loop" echo "Loop check push"
while true while :
do do
echo "Until" until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null
until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null do
do /bin/sleep .1
/bin/sleep .1 done
done
echo "End until"
i=$((i+1))
if [ $i -ge 30 ]
then
sudo systemctl poweroff let i++
echo "Shutdown..." if [ $i -ge 30 ]
break then
fi printf "Shutdown by button"
sudo systemctl poweroff
break
fi
echo "Next Track" echo "Next Track"
/usr/bin/mpc next mpc next
done done
echo "End loop"