Skip to content

Instantly share code, notes, and snippets.

@darkhelmet
Created March 9, 2011 05:51
Show Gist options
  • Save darkhelmet/861756 to your computer and use it in GitHub Desktop.
Save darkhelmet/861756 to your computer and use it in GitHub Desktop.
Run *.c files as scripts. Put this in ~/bin/cscript
#!/usr/bin/env bash
tail -n `wc -l $1 | awk '{ print $1 }'` $1 | gcc -xc - -o ~/.cscript && ~/.cscript
#!/usr/bin/env cscript
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char ** argv) {
printf("Hello, World!\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment