Talk:Shell one-liner: Difference between revisions

(→‎About C and /tmp: in lieu of temporary files)
Line 11:
Yes but this way it won't work on environments that have not /tmp, or use other convention for directory separator (e.g. \ instead of /); I suppose it would have not worked anyway out of a posix-like shell... --[[User:ShinTakezou|ShinTakezou]] 11:00, 9 February 2009 (UTC)
: It wouldn't have, which is why I felt justified adding /tmp, touch and chmod. /tmp was the only widely-available approach I could think of for temporary files. I would have preferred a means to have gcc output to stdout, and then execute that, but I don't know of any shell or common program that would allow you to execute a raw binary fed in by way of STDIN. --[[User:Short Circuit|Short Circuit]] 16:35, 9 February 2009 (UTC)
 
The C example could be quite shorter:
echo 'main() {printf("Hello\n");}' | gcc -w -x c -; ./a.out ; rm a.out
(But it would overwrite a possible 'a.out' in the current directory...) [[Special:Contributions/187.25.221.53|187.25.221.53]]
Anonymous user