File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # get user input in minutes
4
+ read -p " Enter countdown time in minutes: " countdown_minutes
5
+
6
+ # confirm countdown time with user
7
+ read -p " Start a countdown of $countdown_minutes minutes? [Y/n]" confirm
8
+ confirm=${confirm:- Y} # set default value to Y if user presses enter without entering a value
9
+
10
+ # exit script if user doesn't confirm countdown
11
+ if [[ ! " $confirm " =~ ^[Yy]$ ]]; then
12
+ echo " Countdown canceled."
13
+ exit 0
14
+ fi
15
+
16
+ # convert minutes to seconds
17
+ countdown_time=$(( countdown_minutes * 60 ))
18
+
19
+ # ignore hangup signal and continue running in the background
20
+ nohup bash -c " sleep $countdown_time && paplay /usr/share/sounds/freedesktop/stereo/complete.oga && notify-send 'Countdown complete!' 'The countdown has finished.'" > /dev/null 2>&1 & disown
21
+
You can’t perform that action at this time.
0 commit comments