Bash will report error if you define function, which named the same as special 
builtin commands, in POSIX mode:
$ bash --norc --posix$ bash-4.3$ eval() { echo func;}bash: `eval': is a special 
builtin
The problem here is bash doesn't forget those type of functions if they were 
defined before POSIX mode enabled.
-- Mr. LE Manh CuongMobile: +84 1216 181090Skype: manhcuongle> Subject: Re: 
"type" may return incorrect information after posix mode is enabled
> To: stephane.chaze...@gmail.com; bug-bash@gnu.org
> From: ebl...@redhat.com
> Date: Tue, 21 Jul 2015 08:07:15 -0600
> 
> 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.
> 
> 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.
> 
> > (actually, having "eval is a special shell builtin" like in
> > dash/mksh/ksh93/yash would be nice)
> 
> Yes, distinguishing between special and other built-ins would indeed be
> nice.
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 
                                          

Reply via email to