leah blogs

July 2013

15jul2013 · Summer of Scripts: com

My tool com is a shell script port of Tom Duff’s tool with the same name.

com allows you to put commands into files (usually compile instructions) and run them:

% cat hello.c 
/*% cc -o # %
 */
main() {
        printf("hello, world!\n");
}
% com hello.c
hello.c: In function ‘main’:
hello.c:4:2: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
  printf("hello, world!\n");
  ^
% com
hello.c: In function ‘main’:
hello.c:4:2: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
  printf("hello, world!\n");
  ^

Note that the second com invocation doesn’t pass the arguments since they are saved in .comfile.

I have extended it to also support the magic sequence #% in addition to /*% to support more languages.

NP: Molotow Soda—Letzte Schritte

Copyright © 2004–2022