bash provides two built-in commands that can be used to control program flow inside loops. The
break command immediately terminates a loop, and program control resumes with the next statement following the loop. The
continue command causes the remainder of the loop to be skipped, and program control resumes with the next iteration of the loop. Here we see a version of the
while-menu program incorporating both
#!/bin/bash # while-menu2: a menu driven system information program DELAY=3 # Number of seconds to display results
while true; doclear cat <<- _EOF_ Please Select: 1. Display System Information 2. Display Disk Space 3. Display Home Space Utilization 0. Quit _EOF_ read -p "Enter selection [0-3] > ...