#!/bin/sh # # get-timestamp - helper script to obtain a timestamp from the user # # Copyright © 2008 martin f. krafft # Released under the terms of the Artistic Licence 2.0 # set -eu if [ -z "${__RLWRAPPED:-}" ] && [ -x $(command -v rlwrap) ]; then __RLWRAPPED=true exec rlwrap "$0" "$@" fi printf 'When should I tickle you about this message? ' >/dev/tty read timespec &2 exit 1 ;; *) date="now + $timespec days 00:00";; esac exec date +'%s (%c)' -d "$date"