Use the gcc options -x and -
$ echo -e '#include <stdio.h> \ nmain () {puts ("Hello world"); return 0;}' | gcc -xc -ogarbage - && ./garbage && rm garbage
Hello world
The one line above consists of the following parts:
echo -e '#include <stdio.h> \ nmain () {puts ("Hello world"); return 0;}' # "source"
| # pipe
gcc -xc -ogarbage - # compile
&& # and
./garbage # run
&& # and
rm garbage # delete
source share