On 10/08/2017 03:11 PM, Eduardo A. Bustamante López wrote: > I guess that instead of changing the semantics of > command_not_found_handle, a new special trap could be added that > executes in the context of the shell performing the command lookup.
Possible, but magic traps can be ugly. I often end up just calling a function from one, otherwise there's no locals or positional params, though you do get to see the params of the calling context as compensation. A trap would need a new way to pass in the command name and args. > Although I'm not sure how valuable it would be (the added complexity). > Are there any serious uses of the command_not_found_handle aside from > suggestions during interactive use? Mostly non-serious uses in bash libraries that implement wacky features. command_not_found handle is the only "special" function in bash at the moment. It's reminiscent of discipline functions, which would be a sensible place to put this. Huge feature to implement though unless maybe the dynamic variable code can be substantially reused.
signature.asc
Description: OpenPGP digital signature