Last active
June 19, 2023 16:23
-
-
Save aayushmau5/f74f9a3ebe42ccee85dbecc68dd285e9 to your computer and use it in GitHub Desktop.
Bash script that waits for certain minutes and then sends notification - PopOS!
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
# 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