pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


make_numtree1.ksh93 - build makefile to generate number sequence
Posted by Anonymous on Thu 18th Jul 2024 20:53
raw | new post
view followups (newest first): make_numtree1.ksh93 - build makefile to generate number sequence by Anonymous

  1. #!/bin/ksh93
  2.  
  3. #
  4. # make_numtree1.ksh93 - build makefile to generate number sequence
  5. #
  6.  
  7. function make_number_seq
  8. {
  9.         nameref out_maketarget=$1
  10.         integer start_i=$2
  11.         integer stop_i=$3
  12.         integer i
  13.         typeset -a make_targets
  14.  
  15.         for ((i=start_i ; i < stop_i ; i++ )) ; do
  16.                 printf 'i_%d:\n' i
  17.                 printf '\tprintf "%d\\n" >"i_%d"\n' i i
  18.                 make_targets+=( "i_$i " )
  19.         done
  20.  
  21.         out_maketarget="i_${start_i}_${stop_i}"
  22.         printf 'i_%d_%d: %s\n' start_i stop_i "${make_targets[*]}"
  23.         printf '\tcat %s >"%s"\n' "${make_targets[*]}" "$out_maketarget"
  24.  
  25.         return 0
  26. }
  27.  
  28. typeset make_target
  29.  
  30. make_number_seq make_target 0 100
  31.  
  32. printf 'all: %s\n' "$make_target"
  33. # 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