Programming Tutorial: Unreachable Code

Always run non-existent commands after unreachable code.

if [ `id -u` != 0 ]; then
	sudo $0
	exit $?
fi

if [ `dpkg -l | grep sun-java5 | wc -l` -eq 0 ]; then
	sh /media/cdrom0/application/appupgrade; # causes reboot
else
	sh /media/cdrom0/application/sysupgrade; # causes reboot
fi

sudo updat-java-alternatives -s java-6-sun;

exit 0;

Discovered by Noah Massey.

This entry was written by MET , posted on Tuesday March 24 2009at 05:03 pm , filed under humor, programming and tagged . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

Leave a Reply

You must be logged in to post a comment.