I've been reviewing this script and making some changes for our organization. I noticed in the following code there are some missing $ in the variables that are established further up. Notice DEFER_TIME_LEFT and EACH_DEFER are lacking a $. I don't believe this was intentional and it appears to still function, but as we haven't deployed this to our full organization and are testing I wanted to bring it up. Starts on line 417
if (( DEFER_TIME_LEFT > 0 )); then
# Substitute the correct number of hours remaining.
if (( DEFER_TIME_LEFT > 7200 )); then
MSG_ACT_OR_DEFER="${MSG_ACT_OR_DEFER//%DEFER_HOURS%/$(( DEFER_TIME_LEFT / 3600 ))}"
MSG_ACT_OR_DEFER="${MSG_ACT_OR_DEFER// 1 hours/ 1 hour}"
elif (( DEFER_TIME_LEFT > 60 )); then
MSG_ACT_OR_DEFER="${MSG_ACT_OR_DEFER//%DEFER_HOURS% hours/$(( DEFER_TIME_LEFT / 60 )) minutes}"
MSG_ACT_OR_DEFER="${MSG_ACT_OR_DEFER// 1 minutes/ 1 minute}"
else
MSG_ACT_OR_DEFER="${MSG_ACT_OR_DEFER//after %DEFER_HOURS% hours/very soon}"
fi
# Determine whether to include the "you may defer" wording.
if (( EACH_DEFER > DEFER_TIME_LEFT )); then
# Remove "{{" and "}}" including all the text between.
MSG_ACT_OR_DEFER="$(echo "$MSG_ACT_OR_DEFER" | sed 's/{{.*}}//g')"
else
# Just remove "{{" and "}}" but leave the text between.
MSG_ACT_OR_DEFER="$(echo "$MSG_ACT_OR_DEFER" | sed 's/[{{|}}]//g')"
fi
I've been reviewing this script and making some changes for our organization. I noticed in the following code there are some missing $ in the variables that are established further up. Notice DEFER_TIME_LEFT and EACH_DEFER are lacking a $. I don't believe this was intentional and it appears to still function, but as we haven't deployed this to our full organization and are testing I wanted to bring it up. Starts on line 417
if (( DEFER_TIME_LEFT > 0 )); then