I've been dinking around with es, which is pretty neat, but didn't have my bash standbys (CTRL-R incremental search, ! history manipulation). Well, turns out that all my beloved bashisms are actually Gnu Readline-isms. Here's a joke shell that handles control characters, reverse search, history expansion, etc.:
// gcc jokesh.c -o jokesh -l readline #include <stdio.h> extern char *readline(char *); extern void add_history(char *); int main (int argc, char **argv) { char *r, *s; while (1) { r = readline("> "); history_expand(r, &s); if (s && *s) { add_history(s); system(s); // yeah, yeah, i'm using sh for | and pathing } if (r && free(r)) r = (char *) NULL; if (s && free(s)) s = (char *) NULL; } exit(0); }
That's it. So, it turned out to be really trivial to add the "bash" features I wanted to es.