On Fri, May 21, 2010 at 11:37:59AM -0500, Peng Yu wrote: > Since pwd is a shell command, when /bin/pwd is actually used? In > shells that don't have built-in pwd?
The primary reason it exists as a separate program is for strict conformance to POSIX and other standards, which require the presence of such a program independent of the shell. It could be invoked by a shell, as you say; or by someone doing execlp("pwd", (char *)NULL); (or equivalent) in C. In theory it could also be invoked by someone doing find . -exec pwd \; but I honestly can't think of a good reason why anyone would do that.