redef'ing a variable as a command line parameter

I haven’t redef’d a variable from the command line since Bro 2.5, now running Zeek 4.2.0-dev.78 and I’m getting the following error:

error in , line 1: syntax error, at or near “redef” or end of file ./test.zeek

Example is super simple for trying to understand what I’m doing wrong - test.zeek:

const s1 = “world” &redef;
print fmt(“hello %s”, s1);

On the command line:

zeek ./test.zeek s1=“zeek”

error in , line 1: syntax error, at or near “redef” or end of file ./test.zeek

If I modify the script as follows it works fine:
const s1 = “world” &redef;
redef s1=“zeek”;
print fmt(“hello %s”, s1);

zeek ./test.zeek

hello zeek

What am I missing??

~Troy

const s1 = “world” &redef;
print fmt(“hello %s”, s1);

Turns out this will work if you instead use an event handler like zeek_init to print the string:

const s1 = “world” &redef;
event zeek_init()
    {
    print fmt(“hello %s”, s1);
    }

The reason is because the way that Zeek handles command-line redefs is to literally add a redef to the end of the input. That’s not legal if the input ends in direct statements, but is legal if the input ends in an event handler (which, technically, is seen as a declaration/definition, and not a statement).

— Vern