Advertisement
metalx1000

Get Sunset time

May 8th, 2015
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. location="2232" #Naples FL
  4. year=`date +"%Y"`
  5. month=`date +"%m"`
  6. day=`date +"%d"`
  7.  
  8. url="http://staging.timeanddate.com/worldclock/astronomy.html?n=$location&month=$month&year=$year&obj=sun&afl=-13&day=$day"
  9.  
  10. time=`wget "$url" -O- -q|\
  11.   sed 's/<tr class=c0>/\n<tr class=c0>/g'|\
  12.   grep "class=c0"|\
  13.   head -n1|\
  14.   grep PM|\
  15.   sed 's/<\/td><td>/|/g'|\
  16.   cut -d\| -f9|\
  17.   cut -d\< -f1`
  18.  
  19. echo "Sunset is at $time"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement