SUMMARY : /usr/bin/cd ?!?!

From: <matthew.hannigan_at_nl.abnamro.com>
Date: Mon Nov 05 2001 - 09:55:03 EST
Short answer:  It's for Unix98 standards conformance.

Long answer: Let me just quote Dan Astoorian:


>Almost, but not quite, true.  The following construct:
>    /usr/bin/cd $DIR 2>/dev/null || /usr/bin/echo "$DIR is unavailable"
>
>technically speaking, "works", in that it produces an error message if
>$DIR does not exist or cannot be traversed.
>
>> Does anyone have a vaguely rational reason for it's existance?
>
>Standards conformance.  My understanding is that all POSIX-mandated
>shell builtin commands have to have equivalents in the standard path, so
>that an exec*() of the command will not fail (irrespective of whether it
>does something useful).
>
>You're correct that it's not particularly useful from a practical
>standpoint for "cd" (or "fg", or "bg", or--my personal favourite--
>"unalias").


The response from the omniscient omnipresent Casper Dik is also worth
quoting:

> UNIX 98 bogosity.



Other respondents mentioned that it is just one of links to one file;
many of the other links, such as ulimit , alias also don't make sense
as commands.


My further comment:

I was originally was drawn to the existance of this file by someone who
had a coding standard in his organisation that insisted that scripts use
the full pathname.  This shows that even having this /usr/bin/cd _exist_
has a negative effect.

We have here a command which will do nothing, is guaranteed to do nothing
except be tested whether it 'execable'; an operation which does not make
sense.
Sigh.  The lunatics have taken over the asylum.

Rather humourous were the comments in some versions on other machines.  The
DEC
version is mostly comments and copyright statement.  In the HP version,
some
"helpful" person has changed the comment from the correct "execable" to the
more
standard english but unhelpful word "executable".




My original question:




I just found out that /usr/bin/cd exists on Solaris 2.6, 7, and 8.

That's utterly bizarre.  It does not work, cannot work, will never work,
 and it will just confuse newbies.

Does anyone have a vaguely rational reason for it's existance?

Regards,
     -Matt






---------------------------------------------------------------------------
This  message  (including  any  attachments)  is  confidential  and  may be
privileged.  If you have received it by mistake please notify the sender by
return  e-mail  and  delete this message from your system. Any unauthorised
use  or  dissemination  of  this  message  in  whole or in part is strictly
prohibited.  Please  note  that e-mails are susceptible to change. ABN AMRO
Bank  N.V.  (including  its  group  companies)  shall not be liable for the
improper  or  incomplete  transmission of the information contained in this
communication  nor  for  any delay in its receipt or damage to your system.
ABN  AMRO  Bank  N.V.  (or its group companies) does not guarantee that the
integrity   of  this  communication  has  been  maintained  nor  that  this
communication is free of viruses, interceptions or interference.
---------------------------------------------------------------------------
Received on Mon Nov 5 14:55:03 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:34 EDT