Skip to content

Instantly share code, notes, and snippets.

@ecounysis
Created June 22, 2011 00:39
Show Gist options
  • Save ecounysis/1039285 to your computer and use it in GitHub Desktop.
Save ecounysis/1039285 to your computer and use it in GitHub Desktop.
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";cc -o "$x" "$0")&&"$x" $*;exit
#include <stdio.h>
int main() {
char c;
while ((c = getchar()) != EOF)
putchar(c);
return 0;
}
// I'd call this the most useful. I put this at the top of any simple single-file C scripts, so that I can execute them directly. It compiles if necessary and calls the executable, passing on any parameters.
// http://stackoverflow.com/questions/12830/most-elegant-amusing-or-strange-code-one-liners/12907#12907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment