Created
June 19, 2024 12:56
-
-
Save martindufresne/48c827794ab461291329326e0ef35aff to your computer and use it in GitHub Desktop.
Script bash qui prend une capture d'écran toutes les X secondes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if interval argument is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 -int <interval_in_seconds>" | |
exit 1 | |
fi | |
# Extract the interval value | |
interval=$2 | |
counter=1 | |
while true; do | |
# Take a fullscreen screenshot and save it to the current directory with a sequential name | |
screencapture -x ./${counter}.png | |
# Increment the counter | |
((counter++)) | |
# Wait for the specified interval | |
sleep "$interval" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment