fix little bugs
This commit is contained in:
parent
0c13b19e9d
commit
ecdd05c0d1
@ -156,7 +156,10 @@ main(){
|
|||||||
while [[ "$#" -gt 0 ]]; do
|
while [[ "$#" -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-a|--all)
|
-a|--all)
|
||||||
certList=($CERTS_PATH/*.crt)
|
# set - if no .crt → files=() (empty)
|
||||||
|
shopt -s nullglob
|
||||||
|
certList=("$CERTS_PATH"/*.crt)
|
||||||
|
shopt -u nullglob
|
||||||
cert_info
|
cert_info
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@ -180,6 +183,9 @@ main(){
|
|||||||
# check if nbr days is numeric and > 1 and < $DAYS
|
# check if nbr days is numeric and > 1 and < $DAYS
|
||||||
elif [[ "$2" =~ ^[0-9]+$ ]] && [ "$2" -ge 1 ] && [ "$2" -le "$DAYS" ]; then
|
elif [[ "$2" =~ ^[0-9]+$ ]] && [ "$2" -ge 1 ] && [ "$2" -le "$DAYS" ]; then
|
||||||
expired_date $2
|
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
|
for certData in "${expireDate[@]}"; do
|
||||||
daysLeft=$(echo $certData | cut -d"|" -f1 )
|
daysLeft=$(echo $certData | cut -d"|" -f1 )
|
||||||
cn=$(echo $certData | cut -d"|" -f2 )
|
cn=$(echo $certData | cut -d"|" -f2 )
|
||||||
|
|||||||
@ -99,6 +99,9 @@ main(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
expired_date $2
|
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
|
for certData in "${expireDate[@]}"; do
|
||||||
COMMON_NAME=$(echo $certData | cut -d"|" -f2 )
|
COMMON_NAME=$(echo $certData | cut -d"|" -f2 )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user