#!/bin/bash # example05 # # Script prompts for a number and if it doesn't get one # it will assign 12. # # Script then declares value of variable $top_end value # to be $number + 10 # # While loop will print $number then increase by one then # print, etc. until $number = $top_end. Then process will # break out of the loop #################################################################### clear echo echo echo -e "Enter a number and I'll take it for a loop ten times: " read number # Check for null variable test -n "$number" if [ $? -eq 1 ]; then echo -e "\nYou did not enter a number, Default is 12. You got it!\n" number=12 fi top_end=$(($number+10)) # Bash can handle some math, but integers only echo echo echo "Number is $number" echo "Top_end is $top_end" echo # pause for 2 seconds sleep 2 while [ $number -lt $top_end ]; do echo "Number = $number" let number=$number+1 done echo echo #end of script