New feature! Upgrade and increase expert visibility of your issues with Priority Questions.
#!/bin/bash echo "Author: Joe" echo "Date: Saturday, May 02, 2009" echo echo "Displaying the content of a file from week 2." echo cat /mnt/sdb/week2/joe.3-7 echo echo echo "Please enter week number (1, 2 or 3) or q to quit." read num echo ((test=1)) while test $num != q do if [ $num -lt 4 ] then echo "The files submitted in week $num are:" ls ../week$num/joe* else echo "Incorrect week number!" fi ((file=1)) while test $file != q do echo echo "Please enter file name to view the contents." read file if [ -f ../week$num/$file ] then echo echo "The contents of file $file are:" cat ../week$num/$file echo "The files submitted in week $num are:" ls ../week$num/joe* else read -p "Incorrect file name! Please select again or enter q" fi ((file++)) done ((test++)) echo echo "Please enter week number (1, 2 or 3) or q to quit." read num echo done
Join the community of 500,000 technology professionals and ask your questions.