Thanks, all. I've made up my first loadable bash builtin and it's running fine.
Another problem: There's a select() system call in my builtin which looks like this: rc = select(0, &fds, NULL, NULL, &tmout); if (rc < 0 && EINTR == errno) { return 9; } When select() was waiting there, I pressed CTRL-C to break it. Then I expected the bash var $? to be 130 (= 128 + SIGINT) but actually $? was 137 (= 128 + 9). So how can I fix it to make $? be 130 when interrupted by CTRL-C? Thanks, Clark On Sat, Jan 30, 2010 at 10:17 PM, Joachim Schmitz < nospam.j...@schmitz-digital.de> wrote: > Clark J. Wang wrote: > >> Hi all, >> >> I want to write my own built-in bash commands but I cannot find any >> info about that in bash manual. Anyone has any idea? >> > > Have a look into the .def files in the builtins directory of bash's source > tree. > Add your .def file (start with a copy of an existing one changed to your > needs), update Makefile (or better Maklefile.in) and you're done. > Did this myself to add a couple of platform specific builtins > > Bye, Jojo > > >