I think I have come up with a better alternative to generating the Lua test files: Replace #!/usr/bin/lua with: #!/bin/sh test -z "$LUA" && LUA=/usr/bin/lua exec $LUA << END_OF_FILE Apparently, one can leave out the END_OF_FILE marker. Cheers, -Hilko