diff --git a/lib/expired-date.sh b/lib/expired-date.sh index 0878e7b..4b70b24 100644 --- a/lib/expired-date.sh +++ b/lib/expired-date.sh @@ -26,8 +26,8 @@ expired_date(){ shopt -u nullglob if [ "${#certList[@]}" -gt "0" ]; then for crtFile in "${certList[@]}"; do - # set data from certfificate - cn=$(openssl x509 -noout -subject -in $crtFile | cut -d"=" -f3) + # set data from certfificate. xargs remove space at begin and end cn + cn=$(openssl x509 -noout -subject -in $crtFile | cut -d"=" -f3 | xargs) expiration=$(openssl x509 -noout -in $crtFile -enddate | cut -d"=" -f2) # convert in timestamp Unix exp=$(date -u -d "$expiration" +%s)