cat <<EOF >arg.c #include <stdio.h> int main(int argc, char *argv[]) { printf("argv[1]=%s\n", argv[1]); return(0); } EOF gcc arg.c -o arg ./arg "$(command which prints something)"
#include <stdio.h> #include <stdlib.h> int main() { char buf[512]; FILE *fp=popen("ls", "r"); while(fgets(buf, 512, fp)) printf("Got line '%s'\n", buf); pclose(fp); }