04-29-2020, 07:12 AM
For example, you can use this script and add the function time.
When starting the script, read time, from the last call and compare with the current time.
if the value $delta is small, you pressed the button twice.
like this you can extend the functions
When starting the script, read time, from the last call and compare with the current time.
Code:
#!/bin/bash
t1=$(date +%s)
echo $t1
t2=$(cat time.log)
echo $t2
delta=$(( ($t1-$t2) ))
echo $t1 > time.log
echo $delta
if [ $delta -lt 2 ]
then
echo "Button pressed twice"
double=1
fi
if the value $delta is small, you pressed the button twice.
like this you can extend the functions