Page 1 of 1

scripting in pure C

Posted: Tue Nov 25, 2014 10:45 am
by DebianJoe
Cool trick if you're not that into shell scripting and prefer C.

Grab a copy of TCC here, because it doesn't create a ton of bytecode overhead. It's fast, and if you're that into C, you want it anyhow.

Write a program in C to do what you like, but then above all the includes, add a shebang line like this:

Code: Select all

#!/usr/local/bin/tcc -run
Chmod your file to 755 (or +x, assuming that's how you roll), and then just run it as a script.
2014-11-25-033736_1024x768_scrot.png

Re: scripting in pure C

Posted: Tue Nov 25, 2014 2:59 pm
by machinebacon
oh wow, that's really cool :) Thanks for the share!

Re: scripting in pure C

Posted: Tue Nov 25, 2014 3:32 pm
by GekkoP
Very cool, my kind of stuff. Thank you, Joe.

Re: scripting in pure C

Posted: Wed Nov 26, 2014 12:49 pm
by wuxmedia
Thats probably the only way i'd get into writing C
gcc and make and all that stuff feels a bit of a drag, compared to knocking up a * script
Nice share.

Re: scripting in pure C

Posted: Wed Nov 26, 2014 10:50 pm
by Dr_Chroot
^ This. Couldn't have said it better myself :D Thanks Joe.