#!/bin/bash
#Copyright 2014 Brendan Perrine
# This is a simple bash script that shows the offset to UTC from your current time zone 

 
#note that can't have same day on different years as are not that many time zones  
if [ $(date +%j)  -eq $(date -u +%j) ] ; then 
  echo " $(date  +%H) - $(date  -u +%H) "|bc
#new years first because of otheruwise I can't use day number accuratly
elif [ $(date +%Y) -gt $(date -u +%Y ) ]; then 
  echo " [[$( date +%H )+24 ]]  - $(date -u +%H)"|bc
elif [ $(date +%Y) -lt $(date -u +%Y) ] ;then
  echo " $(date +%H ) -  [[$( date +%H )+ 24 ]] "|bc
elif [ $(date +%j ) -gt $( date -u +%j )] ; then 
 echo " [[$(date +%H +24) ]] - $(date -u +%H) "|bc 
else 
 echo "$(date +%H ) - [[$( date -u +%h) + 24 ]]  "|bc
fi 

#!/bin/bash
#Copyright 2014 Brendan Perrine
# This is a simple bash script that shows the offset to UTC from your current time zone 

 
#note that can't have same day on different years as are not that many time zones  
if [ $(date +%j)  -eq $(date -u +%j) ] ; then 
  echo " $(date  +%H) - $(date  -u +%H) "|bc
#new years first because of otheruwise I can't use day number accuratly
elif [ $(date +%Y) -gt $(date -u +%Y ) ]; then 
  echo " $( date +%H ) + 24   - $(date -u +%H)"|bc
elif [ $(date +%Y) -lt $(date -u +%Y) ] ; then
  echo " $(date +%H ) -  $( date +%H ) - 24 "|bc
elif [ $(date +%j ) -gt $( date -u +%j ) ] ; then 
 echo " $(date +%H ) - $(date -u +%H) +24 "|bc 
else 
 echo " $(date +%H ) - $( date -u +%H) -24 "|bc

fi 

Fix different days Fix the different days and also make syntax simpler by just distributing out the the adding or subtracting of 24 instead of using 2 stage bash math that caused syntax error and now do calculation of offset in bc.
Fix different days
 Fix the different days and also make syntax simpler by just distributing out the the adding or subtracting of 24 instead of using 2 stage bash math that caused syntax error and now do calculation of offset in bc.
