#!/bin/bash ############################################################################ # http://LinuxMeister.net/Scripts/while-loop.sh.html # john meister jan 2015 ############################################################################ # display calendar for each month of the year in a file for analysis # testing monthly myth that a month with 5 mondays, 5 Saturdays and 5 sundays # only happens once ever 823 years ############################################################################ echo "display months of year in long list by month" # set Y to first year of series Y=2014 # outside loop is the year, inside loop is the month while [ $Y -le 2016 ] # while the count is less than 2016 - YEAR do # outside loop - years X=1 # declare starting value X=1 for MONTH while [ $X -le 12 ] # while the count is less than 12 do # inside loop - months in year cal $X $Y | tee -a listofyears.txt X=$(( $X + 1 )) # increment variable MONTH by one done # inside loop Y=$(( $Y + 1 )) # increment variable YEAR by one done # cat listofyears.txt | wc -l # (testing to see if file created) ############################################################################ # double loop works, creates a list of months starting at 2014 - 2016 ############################################################################ # test for 5 Mo, 5 Sat, 5 Sun in one month ############################################################################