#!/bin/sh
#
# Download NASA picture of the day.
#

addr="https://apod.nasa.gov/apod/"
html=$(curl -s "$addr")
img=$(printf "%s" "$html" | grep -m1 "IMG SRC" | awk -F'"' '{print $2}')

file="${img##*/}"

[ -n "$file" ] && [ ! -f "$file" ] && curl -s -O "$addr$img"
