Created
July 30, 2018 22:40
-
-
Save BackSlasher/b3d3654aec1a59cb61599e5d35cd58ba to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
FORMAT='+%Y-%m-%d %H:%M:%S' | |
SHORT_FORMAT='+%H:%M:%S' | |
my_date() { date "$FORMAT"; } | |
short_date() { date "$SHORT_FORMAT"; } | |
CURRENT_TZ="$(timedatectl show | perl -ne 'print $1 if /Timezone=(.*)/')" | |
HOME_TZ="Asia/Jerusalem" | |
if [[ "$CURRENT_TZ" == "$HOME_TZ" ]]; then | |
my_date | |
else | |
#echo -n "HOME: $(TZ="$HOME_TZ" short_date) | HERE: $(my_date)" | |
echo "$(my_date) (HOME: $(TZ="$HOME_TZ" short_date))" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment