Date comparison in shell script
In my script to monitor expiry date of .der certificates, I managed to take out the expiry date of the certificate but when I compare with the c开发者_运维技巧urrent date, its not happening. The expiry date has m/d/yy format, I compared that with current date of the same format(mm/dd/yy) its failing. When I grep the expiry date, is the result has the same date format or it changes to string? Can you please help me with this?
d=7/7/11
dd=$(IFS=/; printf "%02d/%02d/%02d" $d)
echo $dd # => 07/07/11
精彩评论