Skip to content

Instantly share code, notes, and snippets.

@lae
Created December 23, 2017 19:53
Show Gist options
  • Save lae/d9a29633aeb2d02ed2e7f945ffd78fac to your computer and use it in GitHub Desktop.
Save lae/d9a29633aeb2d02ed2e7f945ffd78fac to your computer and use it in GitHub Desktop.
#!/bin/bash
read -p"How many alarms?" count
for c in $(seq 1 $count); do
read -p"What time are you setting alarm #${c} for? " date
echo "Okay, will ring you on $(date --date="$date")."
# Create a subshell and background it
(
sleep $(( $(date --date="$date" +%s) - $(date +%s) ));
echo 'Wake up!' #or whatever action you want to take
)&
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment