Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
RE: /usr/bin/cd??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: /usr/bin/cd??

> New in 10.4: Something called "/usr/bin/cd"; no man page, it's a
> 1-line, quite obscure, shell command.
> If I use a 'cd' in a ".term" command, that shell file gets
> executed, in
> place of the built-in 'change directory' command.
> Can anyone spare a clue as to what it's all about?

I'm going on some old memories here, so I cannot provide a very
detailed explanation, but the reason /usr/bin/cd exists is due
to a POSIX requirement that relates to aliases and being able to
not use an alias via escaping.  But /usr/bin/cd is a useless
script since if you run cd within a shell script the directory
change only applies to the subshell under which the script runs.
cd cannot be a shell script.

Also, the script is a generic script in that it is used for a
number of commands and not just cd.

I noticed that /usr/bin/cd has a hard link count of 15 on my
10.4 system.  So I looked at the inode number for /usr/bin/cd
(run 'ls -i /usr/bin/cd') and then ran
find /usr/bin -inum number_from_ls -print

All of these are the same script
$ find /usr/bin -inum 51616 -print


Do not post admin requests to the list. They will be ignored.
Darwin-userlevel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 >/usr/bin/cd?? (From: Justin Walker <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.