Skip to content

Instantly share code, notes, and snippets.

@aayushmau5
Last active June 19, 2023 16:23
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 aayushmau5/f74f9a3ebe42ccee85dbecc68dd285e9 to your computer and use it in GitHub Desktop.
Save aayushmau5/f74f9a3ebe42ccee85dbecc68dd285e9 to your computer and use it in GitHub Desktop.
Bash script that waits for certain minutes and then sends notification - PopOS!
# Warning: I used ChatGPT to write this bash script
#!/bin/bash
# Check if an argument is provided
if [ -z "$1" ]; then
echo "Please provide an integer argument."
exit 1
fi
# Check if the argument is a valid integer
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
echo "Invalid argument. Please provide a valid integer."
exit 1
fi
# Convert the argument to minutes
minutes="$1"
# Wait for the specified number of minutes
echo "Waiting for $minutes minute(s)..."
sleep "$((minutes * 60))"
notify-send "Timer Over" # notify-send is used to send notification
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment