Created
March 25, 2018 00:08
-
-
Save akarca/f0619406f9e808cdb9c1939e674f8cb1 to your computer and use it in GitHub Desktop.
getting yesterday's timestamp with date command on mac and linux
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 | |
unameOut="$(uname -s)" | |
case "${unameOut}" in | |
Darwin*) yesterday=$(date -v-1d "+%s");; | |
*) yesterday=$(date +%s --date="-1 days");; | |
esac | |
echo $yesterday |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment