Look at this beauty:
//usr/bin/env zig run "$0" -- "$@" ; exit
const std = @import("std");
pub fn main() !void {
std.log.info("Awesome, it works\n", .{});
}
Let’s make it executable and run it:
chmod +x myscript.zig
./myscript.zig
info: Awesome, it works
This works because //
is a comment in Zig, and just an empty path component as far as the shell is concerned
Thanks to squirl for making the argument passing syntax more robus