A variable assignment before a command sets an environment value for that command invocation without changing the whole script.

Program

Play the script to choose a log level and build the one-command environment prefix.

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

level=
command="LOG_LEVEL=$level ./run-report"
echo "$command"
#!/usr/bin/env bash

level=
command="LOG_LEVEL=$level ./run-report"
echo "$command"
#!/usr/bin/env bash

level=
command="LOG_LEVEL=$level ./run-report"
echo "$command"
environment prefix `NAME=value command` sets `NAME` only for that command run.
temporary value The prefix is useful when one command needs a setting but the script should not export it globally.
command plan This example prints command text instead of executing a project-specific program.