开发者

Date comparison in shell script

开发者 https://www.devze.com 2023-03-23 08:16 出处:网络
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 expir

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号