This week I tried to come up with a portable way to determine whether
a symbol is the name of a function, to replace a method depending on
the output of 'command -V' which, according to the POSIX standard cannot
be relied upon.

The method I used relies checks if the symbol still refers to a command
after it has been undefined as a function.  This works when the `unset -f`
happens at the same shell level as where the functions was defined:

$ f(){ :; }
$ (command -v f)
f
$ unset -f f
$ (command -v f)
$

So far so good, this is what I would expect.
However, if I combine both `unset -f f` with `command -v f` in a single 
subshell, the function is not removed in ksh93:

$ f(){ :; }
$ (command -v f)
f
$ (unset -f f; command -v f)
f
$

During testing, this works as expected for bash, dash, and mksh, but not in 
ubuntu 14.04 ksh93 u+ 2012-08-01.

Is this a bug?

Cheers,
Henk

_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to