Automation scripts are safer when they can show the planned action before applying it. A dry-run flag keeps that choice visible.

Program

Play the script to choose preview or apply mode and see the planned deployment action.

dry_run_plan.sh
#!/usr/bin/env bash

dry_run=
target="staging"
if [ "$dry_run" -eq 1 ]; then
    action="preview"
else
    action="apply"
fi
plan="$action:$target"
echo "$plan"
#!/usr/bin/env bash

dry_run=
target="staging"
if [ "$dry_run" -eq 1 ]; then
    action="preview"
else
    action="apply"
fi
plan="$action:$target"
echo "$plan"
dry run A dry run prints or records the action without applying side effects.
target Keeping the target in a variable makes the plan easy to review.
apply boundary The branch that would apply changes is explicit and testable.