Last active
September 8, 2022 00:09
-
-
Save mbierman/f81b591fd27638b9f4221e9525229eca to your computer and use it in GitHub Desktop.
Gets epoc dates for some number of minutes and hours you select before now. Mostly created for plaing with Firewalla MSP API
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
#!/bin/bash | |
# v 1.0.1 | |
# https://gist.github.com/mbierman/f81b591fd27638b9f4221e9525229eca | |
echo -e "How many minutes before now?" | |
read minutes | |
# min=$(date -v-${minutes}M +%s) | |
minutes=${minutes:=0} | |
echo -e "You entered $minutes minutes\n\n" | |
echo -e "How many hours before now?" | |
read hours | |
hours=${hours:=0} | |
echo -e "You entered $hours hours\n\n" | |
start=$(date -v-${minutes}M -v-${hours}H +%s) | |
startFull=$(date -v-${minutes}M -v-${hours}H '+%A, %B %d, %Y %H:%M') | |
end=$(date +%s) | |
endFull=$(date '+%A, %B %d, %Y %H:%M') | |
echo -e "Start: $start $startFull\nEnd: $end $endFull\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example