04 February 2018

Randomized addition worksheets for kiddos using Bash Pipelines

Following up on a prior randomized worksheet for reading, here's a way to generate as many simple addition worksheets as you care to print:
#!/bin/bash
# Print a US letter page of addition problems using numbers 0 through 10.
(
    for i in $(seq 1 26); do
        printf "%2d %s %2d = \n" "$((RANDOM % 11))" "+" "$((RANDOM % 11))"
    done
) \
| column -nxc 36 \
| sed G \
| head -n -1 \
| a2ps -1 --chars-per-line=32 --no-header --borders=no

21 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. This comment has been removed by a blog administrator.

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. This comment has been removed by a blog administrator.

    ReplyDelete
  16. This comment has been removed by a blog administrator.

    ReplyDelete
  17. This comment has been removed by a blog administrator.

    ReplyDelete
  18. Wow! Such an amazing and helpful post this is. I really love it. It's so good and so awesome.

    ReplyDelete