Send email if Output is available

hello
can anyone debug these lines

	cd /usr/local/scripts
	./build update
	./build versions | grep available
	if [ $? == 0 ]
then
		mail -s "update for server `hostname`" $EMAIL
	else
		echo -e "$YELLOW No update $RESET"
	fi
	echo "Please press a key - Back to main menu . . ." ; read

but hit has lock after this line ./build versions | grep available
this script will run update file and then grep available package if need to update, then send an email to admin about this

could u plz redirect the output to two different files and past the sample contents of those two files ?

./build update > update 	./build versions > versions 
$ head  update versions 

thanks.
--Lohit

can you debug my script?
is it write to use if [ $? == 0 ] ?

Your logic is correct but change the syntax as if [ $? -eq 0 ] . We use == for string comparison.