[Top][All Lists]

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

Re: feature request: file_not_found_handle()

From: Roman Rakus
Subject: Re: feature request: file_not_found_handle()
Date: Tue, 20 Aug 2013 16:44:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

You are badly using features of bash. Write a script which will do things for you, or use any other language/shell.

Please, accept this response as a suggestion.

command_not_found_handle is designed to do other things than you are expecting.


On 08/19/2013 10:29 PM, Andreas Gregor Frank wrote:
Hi Chet,

sorry, i thought you talk about the bash code.
I didn't want to show my own usecase but now i have to ;-):
I have a File class and can construct a File "object" for example:
File anObjectName /etc/passwd
and then i can do
e.g. anObjectName.getInode (this already works with
command_not_found_handle() )
But if i do a:
File /etc/passwd /etc/passwd
and then
/etc/passwd.getInode (i think it would be nice if the normal files in a
filesystem could be treated like objects)
then there is nothing that triggers the command_not_found_handle() to split
"object" and method...
So at the moment slashes are forbidden in object names in my fun project.

Now you know why your bash example for ckexec() isn't a solution for me.


2013/8/19 Chet Ramey <address@hidden>

On 8/19/13 6:57 AM, Andreas Gregor Frank wrote:
Hi Chet,

I have no idea if there is "enough" demand, but i think there will be
ideas to use this feature...
I still think it is a question of consistency to be able to handle a "No
such file or directory event", if i can do this with a "command not found
event" (independent of the command_not_found_handle history).

You say you can easily test whether or not if the file in the pathname

That is not what I said.  I said that you, the script writer, can check
whether or not a filename containing a slash is executable before
attempting to execute it.  Maybe a function something like this (untested):

         case "$1" in
         */*)    ;;
         *)      "$@"  ; return $? ;;

         if [ -x "$1" ]; then
                 other-prog "$@"

``The lyf so short, the craft so long to lerne.'' - Chaucer
                  ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden

reply via email to

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