[Top][All Lists]

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

Re: command_not_found_handle documentation omission

From: Dan Douglas
Subject: Re: command_not_found_handle documentation omission
Date: Mon, 9 Oct 2017 08:31:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

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.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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