Run C files like shell scripts.
-
Install the handler.
install -m 755 cscript /usr/local/bin/cscript -
Register the handler with
binfmt_misc:sudo tee -a /proc/sys/fs/binfmt_misc/register < binfmt_register
cat > hello.c <<EOF
//!cscript
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
EOF
chmod 755 hello.c
./hello.c