In the second command, $CANONICAL_SCHEME is expanded by your shell *before* executing the command. Which mean it is probably undefined.

Here is a quick showcase:

    # Make sure the FOO variable is not defined:
    $ unset FOO

    $ echo $FOO
    
    $

The shell evaluated $FOO (which is unset, thus resulting in a null string). The actual command executed is 'echo' which produce a newline.


    $ env FOO="bar" echo $FOO
    
    $

This time we run the echo command with the FOO variable set to "bar". But FOO is not set when evaluating the command. The command executed ends up being:  env FOO="bar echo. That produces a new line.

Proper way:

    $ env FOO="bar" bash -c 'echo $FOO'
    bar
    $ 

There the echo is running in a bash process that has the FOO variable initialized to 'bar'.

So yeah, that is definitely confusing =)