Nested ifs

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search
← If..else..fiHomeMultilevel if-then-else →

You can put if command within if command and create the nested ifs as follows:

	if condition
	then
		if condition
		then
			.....
			..
			do this
		else
			....
			..
			do this
		fi
	else
		...
		.....
		do this
	fi
← If..else..fiHomeMultilevel if-then-else →