> jump to navigation

edk's notes

execute C

Just a quick one, here's a thing I did recently to execute C source files as scripts. You put this at the top of them:

#!/bin/sh
F=`mktemp`&&tail -n+3 $0>$F&&gcc -xc -o$F $F&&exec $F "$@"

and chmod +x blah.c.