pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


makeseqtree1 - build a POSIX Makefile which generates the number sequence 1...n in small chunks
Posted by Anonymous on Wed 28th Feb 2024 14:33
raw | new post
view followups (newest first): makeseqtree1 - build a POSIX Makefile which generates the number sequence 1...n in small chunks by Anonymous

  1. #!/bin/ksh93
  2.  
  3. #
  4. # makeseqtree1 - build a POSIX Makefile which generates the
  5. # number sequence 1...n in small chunks
  6. #
  7. # This is intenended to be a filesystem test
  8. #
  9.  
  10. #
  11. # Written by Roland Mainz <roland.mainz@nrubsig.org>
  12. #
  13.  
  14. #
  15.  
  16. # sequence 1...200
  17.  
  18. set -o nounset
  19.  
  20. compound c
  21. integer c.i
  22. integer c.s
  23. integer c.e
  24. typeset c.cat_files=''
  25. typeset c.targets=''
  26. integer c.chunk_i=0
  27. typeset c.all_files=''
  28.  
  29. for ((c.i=0 ; c.i < 2000 ; )) ; do
  30.  
  31. ((c.s=c.i , c.e=c.i+20))
  32. printf 'make_seq%d_%d:\n' c.s c.e
  33. printf '\tseq %d 1 %d >"seq%d_%d"\n' c.s c.e c.s c.e
  34. c.targets+="$(printf ' make_seq%d_%d' c.s c.e)"
  35. c.cat_files+="$(printf ' "seq%d_%d"' c.s c.e)"
  36. ((c.i=c.e ))
  37.  
  38. if (( (++c.chunk_i % 5) == 0 )) ; then
  39.         printf 'chunk%d: %s\n' c.chunk_i "${c.targets}"
  40.         printf '\tcat %s >"chunk%d"\n' "${c.cat_files}" c.chunk_i
  41.         c.all_files+="$(printf ' chunk%d' c.chunk_i)"
  42.         c.targets=''
  43.         c.cat_files=''
  44. fi
  45.  
  46. done
  47.  
  48. printf 'all: %s\n' "${c.all_files}"
  49. printf '\tcat %s\n' "${c.all_files}"
  50.  
  51. # EOF.

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at