On 2009-11-11, Benoit Daloze <eregontp / gmail.com> wrote:
> [Note:  parts of this message were removed to make it a legal post.]
>
> Ah ?
>
> ~ $> which cd
> /usr/bin/cd
>
> Under Leopard

builtin `echo ${0##*/} | tr \[:upper:] \[:lower:]` ${1+"$@"}

Doesn't mean it'll actually DO anything.

When you execute a command, your shell forks into a parent process (your
shell) and a child process.  The child process then executes the command.
The child process could, in theory, change *its* directory -- but it can't
change the directory of the parent process:

$ pwd
/tmp
$ /usr/bin/cd /
$ pwd
/tmp

I have no idea why that command exists.

(I also have no idea why they use the ${1+"$@"} idiom, since it's been
irrelevant on virtually everything for years, and certainly never made
any difference on any FreeBSD or Mac OS X shell.)

-s
-- 
Copyright 2009, all wrongs reversed.  Peter Seebach / usenet-nospam / seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!