BSD vs SysV -- [ -w <dir> ] different?

Steve Simmons scs at itivax.iti.org
Wed Dec 13 02:15:32 AEST 1989


I've run into what appears to be an incompatibility between SysV and
BSD (and Ultrix), and wanted to get some feedback:

Given a directory foo, with permissions 777 and owned by root, running
as root the following bourne shell script gives different results:

#!/bin/sh
if [ -w foo ] ; then
	echo It is writable
else
	echo It is not writable
fi

On Ultrix 3.0 (DecStation 3100, largely BSD) and UNIX V.2 (UNIX-PC) the
result is 'It is writable'.  On BSD (VAX 785, unmodified /bin/sh) the result
is 'It is not writable'.  Is this correct?  And if so, why?
-- 
Steve Simmons	       scs at iti.org         Industrial Technology Institute
	'"You're not a big name on Usenet until someone puts
	  you in their .sig file."		-- Anonymous'



More information about the Comp.unix.questions mailing list