From e877e8ebd7d67d025a154a47daded892710e299c Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 18 Feb 2011 12:29:36 +0100 Subject: [PATCH 1/1] more flexible timespec parsing --- .mutt/get-timestamp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.mutt/get-timestamp b/.mutt/get-timestamp index 5d00f32..919936a 100755 --- a/.mutt/get-timestamp +++ b/.mutt/get-timestamp @@ -15,18 +15,19 @@ printf 'When should I tickle you about this message? ' >/dev/tty read timespec &2 + exit 1 + ;; @[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|*' '*) date="$timespec";; *[0-9]y) date="now + ${timespec%y} years 00:00";; *[0-9]m) date="now + ${timespec%m} months 00:00";; *[0-9]w) date="now + ${timespec%w} weeks 00:00";; - *[0-9]d) date="now + ${timespec%d} days 00:00";; + *[0-9]d|*[0-9]) date="now + ${timespec%d} days 00:00";; *[0-9]h) date="now + ${timespec%h} hours";; - *[!0-9]*) - echo "E: invalid timespec: $timespec" >&2 - exit 1 - ;; - *) date="now + $timespec days 00:00";; + *' '*) date="$args";; + *) date="$timespec";; esac exec date +'%s (%c)' -d "$date" -- 2.39.5