From 53e3152fdbc8441ecbc5d80d94046231286a502f Mon Sep 17 00:00:00 2001 From: cstsw <30345010+cstsw@users.noreply.github.com> Date: Thu, 13 Feb 2020 17:39:28 +0100 Subject: [PATCH] Unset variables before evaluating options (avoid conflicts with environment variables) Before the arguments to the script are evaluated all variables that are used in subsequent control flow are unset (in order to avoid conflicts with corresponding variables defined in the environment already). --- ssl-cert-check | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ssl-cert-check b/ssl-cert-check index 30b10d8..dcfa8f3 100755 --- a/ssl-cert-check +++ b/ssl-cert-check @@ -804,6 +804,15 @@ check_file_status() { ################################# ### Start of main program ################################# + +### Unset variables that are used in options-evaluation and subsequent control flow (and could be defined in the environment already) +unset ALARM +unset CERTFILE +unset CERTDIRECTORY +unset HOST +unset NAGIOS +unset SERVERFILE + while getopts abc:d:e:E:f:hik:nNp:qs:St:Vx: option do case "${option}" in