Untitled
unknown
plain_text
19 days ago
591 B
4
Indexable
#!/bin/bash COUNT_FILE="/tmp/quick_click_count.txt" TIME_FILE="/tmp/quick_click_time.txt" now=$(date +%s) # Get previous time and click count prev_time=$(cat "$TIME_FILE" 2>/dev/null || echo 0) count=$(cat "$COUNT_FILE" 2>/dev/null || echo 0) # If more than 3 seconds have passed, reset if [ $((now - prev_time)) -gt 3 ]; then count=0 fi # Increment count count=$((count + 1)) # Save updated values echo "$now" > "$TIME_FILE" echo "$count" > "$COUNT_FILE" # If 4 rapid clicks detected, reset and shut down if [ "$count" -ge 4 ]; then echo 0 > "$COUNT_FILE" shutdown now fi
Editor is loading...
Leave a Comment