Why doesn't this work?
HELLO=WORLD echo $HELLO
In my shell it outputs
That command sets HELLO to the string WORLD only in the environment of echo. But echo ignores that environment variable and merely writes its arguments and a newline. In the shell, (presumably) the variable HELLO is not set at all, so echo just prints a single newline.
Perhaps you want:
HELLO=WORLD; echo "$HELLO"
which is two separate commands. The first sets HELLO in the shell, and the second passes that value as an argument to echo.
The issue is that bash is evaluating and replacing $HELLO before your command executes. If you write a script like:
echo $HELLO
and run HELLO=WORLD ./script, you will see the expected output.