`ARGC` is 0 and `ARGV` is empty, so scripts that read their own arguments in `BEGIN` (a very common idiom) see nothing. ## Reproduction **Rust (incorrect)** ```bash $ ./target/release/awk 'BEGIN { print ARGC; for (i = 0; i < ARGC; i++) print i, ARGV[i] }' one two 0 ``` **GNU (correct)** ```bash $ gawk 'BEGIN { print ARGC; for (i = 0; i < ARGC; i++) print i, ARGV[i] }' one two 3 0 gawk 1 one 2 two ``` ## Test ```rust #[test] fn argv_and_argc_are_set() { ucmd() .args(&["BEGIN { print ARGC, ARGV[1], ARGV[2] }", "first", "x=1"]) .succeeds() .stdout_only("3 first x=1\n"); } ``` Exposed by the GNU awk test suite: argarray, argtest, compare, symtab9.
Activity