Skip to content

Instantly share code, notes, and snippets.

@ottosch
Last active December 29, 2022 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ottosch/1cc25b1b428cbe6c3681b7c21e9bdfff to your computer and use it in GitHub Desktop.
Save ottosch/1cc25b1b428cbe6c3681b7c21e9bdfff to your computer and use it in GitHub Desktop.
Executes a keystroke repeatedly. Useful when playing emulators :)
#! /bin/bash
if [ "$#" -lt "2" ]; then
echo "Usage: $0 <key> <times>"
echo "Example: $0 c 20 - will press c 20 times"
exit 1
fi
for _ in $(seq "$2"); do
xdotool key "$1"
sleep 0.005
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment