vitorpy's Dotfiles
at main 21 lines 524 B view raw
1#!/bin/bash 2 3# Smart clock that shows local time + Warsaw time when traveling 4 5WARSAW_TZ="Europe/Warsaw" 6 7# Get current timezone 8current_tz=$(timedatectl show --property=Timezone --value) 9 10# Get local time 11local_time=$(date '+%a, %d.%m %H:%M') 12 13# Check if we're in Warsaw timezone 14if [ "$current_tz" = "$WARSAW_TZ" ]; then 15 # Just show local time 16 echo "$local_time" 17else 18 # Show local time + Warsaw time in parentheses 19 warsaw_time=$(TZ="$WARSAW_TZ" date '+%d.%m %H:%M') 20 echo "$local_time ($warsaw_time)" 21fi