On Sat, 6 Apr 2013, Thorsten Glaser wrote:

> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exec
>     ... If command is not found, the exit status shall be 127. If 
>     command is found, but it is not an executable utility, the exit 
>     status shall be 126.

Well, ":" is a command but it's not an executable utility. So, is it 
"found" or "not found"?

Could be a reference to "Command Search and Execution"-- 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01

There's also this--
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exit
    ... As explained in other sections, certain exit status values have 
    been reserved for special uses and should be used by applications only 
    for those purposes:

     126
        A file to be executed was found, but it was not an executable 
        utility.
     127
        A utility to be executed was not found.

So I think bash is POSIX compliant, and mksh is not. (Does it aim to be 
compliant?)

$ mksh -o posix -c 'exec :'
$ echo $?
0
$ bash -o posix -c 'exec :'
bash: line 0: exec: :: not found
$ echo $?
127

It seems sensible for exec to search for an executable. Perhaps with
"set +o posix", you might "exec $function_or_builtin" but is there
any benefit?

> 
> ># find /var/tmp/portage/dev-libs/klibc-2.0.2/image -name klcc
> >/var/tmp/portage/dev-libs/klibc-2.0.2/image/usr/bin/klcc
> 
> That means that klcc will end up in /usr/bin/ once installed,
> right?

Right.

Finn

Reply via email to