2015-07-21 08:07:15 -0600, Eric Blake:
> On 07/21/2015 05:07 AM, Stephane Chazelas wrote:
> > With the current git head (and 4.3):
> > 
> > $ ./bash -c 'eval() { echo function; }; set -o posix; type eval; eval echo 
> > not function'
> 
> 'eval' is a special built-in, and as such, cannot be usefully defined as
> a function, because the shell rules for determining which command to
> execute favor special built-ins over functions.
Only in posix mode for bash though. I find that POSIX requirement
silly (probably specifies a limiation found in ksh). zsh also
ignores it.

> If anything, it would be nice if bash errored out on the attempt to
> define a function named 'eval', rather than allowing it to succeed.
[...]

It does error-out when in POSIX mode.

My test case was for the case where the function is defined in
non-posix mode, but type invoked in posix mode.

So, it's a very minor issue as probably unlikely to harm anyone.

-- 
Stephane


Reply via email to