- marked as enhancement
in all scripts: replace use of {0, 1} with "real bash booleans" {/bin/false , /bin/true}
Issue #5
new
Seems aesthetic, but IMHO makes for more readable and robust code. E.g., one can do
# Define/set some "real bash booleans" (which use {/bin/false , /bin/true}
# "under the hood"), and break loop if any clear.
FOUND_ALL_AGSOIL_HOURLY=true
FOUND_ALL_CLM_HOURLY=true
FOUND_ALL_EDGAR_HOURLY=true
FOUND_ALL_GEIA_HOURLY=true
FOUND_ALL_GFED_HOURLY=true
FOUND_ALL_N2O_INPUTS=true
# check* scripts can clear above flags
for CMD in \
'check_agsoil_hourly' \
'check_CLM_hourly' \
'check_EDGAR_hourly' \
'check_GEIA_hourly' \
'check_GFED_hourly' \
; do
if ${FOUND_ALL_AGSOIL_HOURLY} \
&& ${FOUND_ALL_CLM_HOURLY} \
&& ${FOUND_ALL_EDGAR_HOURLY} \
&& ${FOUND_ALL_GEIA_HOURLY} \
&& ${FOUND_ALL_GFED_HOURLY} ; then
## All previously-called check_* functions succeeded, so try next one.
echo -e "\n${MESSAGE_PREFIX}:${CMD}\n"
eval "${CMD}" # comment this out for NOPing, e.g., to `source`
if [[ $? -ne 0 ]] ; then
echo -e "\n${ERROR_PREFIX} '${CMD}': failed or not found\n"
FOUND_ALL_N2O_INPUTS=false
# and handle the error ...
fi
fi
done
Comments (1)
-
reporter - Log in to comment