$cd /bin

Ben Eisenbraun bene at klatsch.org
Wed Nov 21 13:08:42 EST 2007


On Wed, Nov 21, 2007 at 12:42:44PM -0500, Eric Chadbourne wrote:
> > cd: shell built-in command.
> 
> Ah.  That helps.

You didn't ask the next question, which is:

Why is it a shell built-in?  Why isn't it a stand alone utility?

The answer goes into a bit of the Zen of UNIX, so I'll reply with 
(what I hope) is a Zen answer:

 $ cat cd.sh 
#!/bin/sh
cd $1
 $ pwd
/home/bene/tmp
 $ ./cd.sh /etc
 $ pwd
/home/bene/tmp

Why didn't the directory change?

:-)

-ben

--
i plead alignment to the flakes of the untitled snakes of a merry cow, 
and to the republicans for which they scam - one nacho, underpants, with 
licorice and jugs of wine for owls.                       <matt groenig>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Discuss mailing list