ksh and sh

Andrew Beattie andrew at riddle.UUCP
Wed Jul 12 20:06:16 AEST 1989


In article <1154 at crdgw1.crd.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
>In article <372 at trevan.UUCP> trevor at trevan.UUCP (trevor) writes:
>| 
>| 	Using Microport System V/AT and the korn shell for logins
>| I have found if I execute /bin/sh and then execute pwd I get an
>| error message pwd: cannot read .. . I suspect it is something to do with
>                ^^^^^^^^^^^^^^^^^^^
>	What are the permissions on the parent directory? May very well
>be a legitimate problem (although a new one to me).

There again, it may not be a legitimate problem.  I have come across systems
where pwd gets tripped up at the mount point, eg:

You are in the directory /usr/john, where /usr is a mounted file system.

Before the /usr file system is mounted, the /usr directory on the root
file system has 700 permissions.  The root directory of the /usr file
system has 755 permissions, which is what is seen when the /usr filesystem
is mounted on the /usr directory.  This all looks correct.  The problem
is that pwd seems to be able to pick up the permissions of the /usr
directory which should be hidden.

BTW, pwd normaly finds out where you are by knowing where you started and
keeping track of every cd.  The first time you call pwd however, it must climb
up the directory tree to find your location.

When trying to work round this problem, bear in mind that if you cd before
you pwd then pwd will not have to climb the tree and that you may have a 
PWD environment variable, so exporting you PWD variable in your login
shell and puting cd `$PWD` into your .kshrc (run for every ksh you start)
may will be a win.

Andrew



More information about the Comp.unix.questions mailing list