Advertisement
metalx1000

Count number of Friday 13th's

Feb 2nd, 2016
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. for year in {2000..2050}
  4. do
  5.   num=$(cal $year|awk '{print $6 " " $13 " " $20}'|tr ' ' '\n'|grep -c 13)
  6.   echo "$year has $num Friday the 13th's"
  7. done
  8.  
  9. #oneliner
  10. #for year in `seq 2000 2050`;do echo "$year has $(cal $year|awk '{print $6 " " $13 " " $20}'|tr ' ' '\n'|grep -c 13) Friday the 13th's";done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement