Created
June 16, 2018 09:38
-
-
Save meuter/66541878670e4e2133dad8299c5505c6 to your computer and use it in GitHub Desktop.
Using shebang to compile and run C program directly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/gcc -o test "$0" && exec ./test "$@" | |
#include <stdio.h> | |
int main(int argc, const char *argv[]) | |
{ | |
int i; | |
for (i = 0; i < argc; i++) | |
printf("argv[%d] = '%s'\n", i, argv[i]); | |
return 42; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment