matteocorti / check_ssl_cert

A shell script (that can be used as a Nagios/Icinga plugin) to check an SSL/TLS connection.
GNU General Public License v3.0
360 stars 132 forks source link

Avoid subshells #509

Closed matteocorti closed 3 months ago

matteocorti commented 4 months ago

Describe the bug

Several functions as hours_until return an integer. To get the result the function has to be called from a sub shell

VARIABLE=$( hours_until "${param}" )

In this way all the error handling calls inside the function with an exit do not have the desired effect. The sub shell is terminated but the script continues.

The computed value shroud be stored in a variable:

hours_until "${param}" VARIABLE="${HOURS_UNTIL}"