bug-bash
[Top][All Lists]
Advanced

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

Bash 4: command_not_found_handle event handler


From: Jan Schampera
Subject: Bash 4: command_not_found_handle event handler
Date: Fri, 16 Jan 2009 13:54:02 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hello list!

Just a few thoughts, awaiting comments.

Currently, Bash 4 calls a fixed named function
command_not_found_handle() when a command is not found. The basic
approach (to have such a possibility) is great, but:

I can imagine that there may be more internal events to react on in
future. IMHO a more straight forward approach would be to define
handlers for named events, similar like you define handlers for signals
with 'trap'. Infact, 'trap' already is able to define event handlers,
for example EXIT or DEBUG, which aren't signals.

The purpose? When - in future - more events should be handled, the
current approach ends up in an unsorted and mixed list of handler
function names. A common approach for handling internal events would be
better.

I basically see 3 ways:
- extend the 'trap' command to be able to setup (more) event handlers
- make up a new command to setup event handlers
- (from Plan 9 rc shell signal handling, hehe) define a namespace for
function names (e.g. "event_"). An event handler for the event FOO will
be called when it exists, here for example event_FOO()

Opinions? Is this point of view completely stupid or is it needed?

J.




reply via email to

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