In mksh (and pdksh), 'exec' looks up shell functions and builtins before external commands, and if it finds one it appears to do the equivalent of running the function or builtin followed by 'exit'. This turns out[1] to be a bug in POSIX terms; 'exec' is supposed to launch a program that overlays the current shell[2], implying the program launched by 'exec' is always external to the shell.
This means that (exec commandname arguments ...) is a POSIXly correct way of guaranteeing the execution of an external command without specifying the path. In pdksh this is definitely a bug as this behaviour differs from ksh88 which pdksh is supposed to be a clone of. The POSIX spec is also based on ksh88 behaviour. This behaviour also appears to be contrary to the documentation in mksh(1) ("The command is executed without forking, replacing the shell process"). The test script below demonstrates that neither "exec" replaces the shell process as the first executes a shell function and the second (within the function) executes a mksh builtin. testFn() { exec print "this shell execs both functions and builtins" } PATH=/dev/null exec testFn Expected output: something like "testFn: not found". Actual output: "this shell execs" etc. - M. [1] https://www.mail-archive.com/austin-group-l@opengroup.org/msg01469.html [2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_20_14