#!/bin/sh

LAST_KNOWN_ESP_S=2013-11-08
LAST_KNOWN_ESP_J=2013-11-10

LEN_S=28
LEN_J=28

add_days() {
    date=$1
    days=$2
    ts_in=$(date -jf %Y-%m-%d +%s $date)
    sec=$(( days * 24 * 60 * 60 ))
    ts_out=$(( ts_in + sec ))
    echo "  $(date -jf %s +%d.%m.%Y $ts_out)"
}

echo "Next ESP S: "
for i in 1 2 3 4 5 6
do
    add_days $LAST_KNOWN_ESP_S $(( LEN_S * i ))
done

echo "Next ESP J: "
for i in 1 2 3 4 5 6
do
    add_days $LAST_KNOWN_ESP_J $(( LEN_J * i ))
done
