bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any guide about writing my own bash built-in commands?


From: Clark J. Wang
Subject: Re: Any guide about writing my own bash built-in commands?
Date: Tue, 2 Feb 2010 12:03:17 +0800

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.jojo@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
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]