4.3bsd sh problems

hemenway at cdp.UUCP hemenway at cdp.UUCP
Sun Oct 30 13:51:00 AEST 1988


I have been porting some scripts from the System V sh to the 4.3bsd sh
and have some problems.  Any ideas/explanations would be appreciated.

1. I/O redirection problem:
	:
	exec 2> /dev/null
	echo This message goes to /dev/null as it should. 1>&2
	xxabcxx		# error message should go to /dev/null--it doesn't
	< xxabcxx 	# error message should go to /dev/null--it doesn't

The above script sends sh error messages to /dev/null only when stderr is
redirected to /dev/null from the command line that called the script.

2. Problem with test -w:
When I use the -w primitive with test to test a directory, it reports
that the directory is not writeable, regardless of whether it is. 
The -r primitive works fine with directories.

	:
	# if $1 is a directory, this segment reports that $1 is not
	# writeable, regardless of whether it is

	if [ -w "$1" ]
	then
	    echo "write perm"
	else
	    echo "no write perm"
	fi


Kathy Hemenway
{uunet,ucbvax!hplabs}!cdp!sobell!kathy



More information about the Comp.unix.wizards mailing list