Bash: Decisions

Example: Decisions in Bash


	#!/bin/bash
	score=95
	if [ $score -gt 89 ]
	then
		echo That\'s a A.
	else
		echo That\'s not an A.
	fi
	

Output:

  That's a A

Example: Decisions in Bash


	#!/bin/bash
	score=75
	if [ $score -gt 89 ] 
	then
		echo That\'s a A.
	elif [ $score -gt 79 ] 
	then
		echo That\'s a B.
	elif [ $score -gt 69 ] 
	then
		echo That\'s a C.
	elif [ $score -gt 59 ] 
	then
		echo That\'s a D.
	else
		echo That\'s an E.
	fi
	

Output:

  That's a C