New toy package: CCSh

Posted on Fri Feb 2, 2018

I have uploaded a new toy package at Github: CCSh. It is a short and simple gnu Bash script that allows on–the–fly compilation and execution of C language programs as if they are scripts. We just do this:

$ cat demo.c
/* ccsh */
#include <stdio.h>
#include <stdlib.h>

int
main (void)
{
  fprintf(stderr, "hello world!\n");
  exit(EXIT_SUCCESS);
}

$ ccsh demo.c
hello world!

The script targets gnu+Linux systems, so it includes a script rc.ccsh that enables the features of the kernel module binfmt_misc to run C source files as executable programs:

$ chmod 0750 demo.c
$ ./demo.c
hello world!

we just have to open the file with the heading /* ccsh.

The documentation is very incomplete; we have to read the scripts!

I doubt that I will really use it, but it was on my mind… and now I have it.