fix little bugs

This commit is contained in:
Gilles Mouchet 2026-04-27 18:05:50 +02:00
parent 0c13b19e9d
commit ecdd05c0d1
2 changed files with 12 additions and 3 deletions

View File

@ -156,7 +156,10 @@ main(){
while [[ "$#" -gt 0 ]]; do
case "$1" in
-a|--all)
certList=($CERTS_PATH/*.crt)
# set - if no .crt → files=() (empty)
shopt -s nullglob
certList=("$CERTS_PATH"/*.crt)
shopt -u nullglob
cert_info
shift
;;
@ -180,6 +183,9 @@ main(){
# check if nbr days is numeric and > 1 and < $DAYS
elif [[ "$2" =~ ^[0-9]+$ ]] && [ "$2" -ge 1 ] && [ "$2" -le "$DAYS" ]; then
expired_date $2
if [ "${#expireDate[@]}" == "0" ]; then
msg_warn "There are no certificates that expire in less than $2 days."
fi
for certData in "${expireDate[@]}"; do
daysLeft=$(echo $certData | cut -d"|" -f1 )
cn=$(echo $certData | cut -d"|" -f2 )

View File

@ -99,6 +99,9 @@ main(){
exit 1
fi
expired_date $2
if [ "${#expireDate[@]}" == "0" ]; then
msg_warn "There are no certificates that expire in less than $2 days."
fi
for certData in "${expireDate[@]}"; do
COMMON_NAME=$(echo $certData | cut -d"|" -f2 )