Skip to content

Add set -e to all bash scripts #747

@forsyth2

Description

@forsyth2

Request criteria

  • I searched the zppy GitHub Discussions to find a similar question and didn't find it.
  • I searched the zppy documentation.
  • This issue does not match the other templates (i.e., it is not a bug report, documentation request, feature request, or a question.)

Issue description

Currently, only tc_analysis.bash has set -e and even then, it is set a few lines down. set -e should be used so the scripts will immediately fail on any error.

Issue 1: I can't find the relevant messages/GitHub comments, but I seem to recall discussing this before and deciding against it because it would prevent us from being able to manually control error handling with blocks like this:

if [ $? != 0 ]; then
  cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v3_output/test_e3sm_unified_1.12.0rc1_20251015/v3.LR.historical_0051/post/scripts
  echo 'ERROR (3)' > climo_atm_monthly_180x360_aave_1985-1986.status
  exit 3
fi

I.e., the script would just error out and we wouldn't be able to update the status scripts. Perhaps a workaround would be to do:

set +e # Turn off exit-on-failure
<command we want to manually handle errors for>
<error handling block>
set -e # Turn exit-on-failure back on

Issue 2: I also seem to remember that some tasks encounter errors that aren't ultimately job-ending. Therefore, the integration tests should be run set -e on, to confirm a successful run can still be made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions