csh question

reece%nadc at sri-unix.UUCP reece%nadc at sri-unix.UUCP
Sat Feb 25 05:11:19 AEST 1984


I'm having trouble with nesting of csh "if-else-endif". In the following,

----------------------
#! /bin/csh
set x=1
if($x == 1) then
	set y=2
else
	if($y == 2) then
		echo "line 1"
	else
		echo "line 2"
	endif
	echo "shouldn't get here"
endif
echo "finished"
----------------------

when you run it, you get the "shouldn't get here" message printed out.
Does anyone know why? 

Jim Reece
REECE at NADC



More information about the Comp.unix mailing list