-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Martin Wheatley on 7/5/2006 2:58 AM: > > Linking /bin/sh to /bin/bash does NOT maintain the bourne shell API. > > For example, > > Tradition using a traditional bourne shell ... > > xn-sysadm-4 $ sh > xn-sysadm-4 $ PWD=fred > xn-sysadm-4 $ cd / > xn-sysadm-4 $ echo $PWD > fred > xn-sysadm-4 $
That is a bug in traditional bourne shell, and you should not rely on it. POSIX does not permit manually setting PWD to anything other than an actual absolute name, and even allows implementations to reject your attempt to set it to the relative name "fred" as though you had been trying to set a read-only variable. > > But with bash linked as "sh"... > > xn-CDO-2 $ cd /tmp > xn-CDO-2 $ ln -s /bin/bash ./sh > xn-CDO-2 $ ./sh > xn-CDO-2 $ PWD=fred > xn-CDO-2 $ cd / > xn-CDO-2 $ echo $PWD > / POSIX requires this behavior, whether bash is emulating sh (in which case, it is really trying to be POSIX compliant, rather than compatible to old broken bourne sh), or using full extensions. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEq6/N84KuGfSFAYARAstBAKCJhd13/iDDJOzDCz74rVxkwz8UwACeNpKI SJ5ZMCabrMnrSH34kyBtx9U= =ozhB -----END PGP SIGNATURE----- _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash