- date_bad_format=`certtool -i < $cer |
- perl -ne '/Not After: \w+ (\w+ \d+ \d+:\d+):\d+ UTC (\d+)/ && print "$1 $2"'`
- date_good_format=`date -j -f "%b %d %H:%M %Y" "$date_bad_format" +"%Y-%m-%d"`
- print REM $date_good_format +30 MSG $cer
+ certtool --certificate-info < $cer | while read line ; do
+ [[ $line =~ "^\s*Not After: .*" ]] && break
+ done
+ [[ $MATCH ]]
+ # Not After: Sat Jul 02 10:02:29 UTC 2022
+ cols=(${=MATCH})
+ strftime -s ts_ugly -r "%b %d %H:%M:%S UTC %Y" ${(j: :)cols[4,-1]}
+ strftime -s ts_good %F $ts_ugly
+ print REM $ts_good +30 MSG $cer