Changeset 78 for trunk/IPs/systemC/processor/Morpheo/Script/range.sh
- Timestamp:
- Mar 27, 2008, 11:04:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Script/range.sh
r57 r78 4 4 function usage () 5 5 { 6 echo "Usage : $0 min max [step [iter]]"; 6 echo "Usage : ${0} min max [step [iter]]"; 7 echo "Arguments : "; 7 8 echo " * min : value minimal"; 8 9 echo " * max : value maximal"; … … 15 16 function range () 16 17 { 17 declare a=$ 1;18 declare b=$ 2;19 declare step=$ 3;18 declare a=${1}; 19 declare b=${2}; 20 declare step=${3}; 20 21 21 while test $ a -lt $b; do22 echo $ a;23 a=$(($ a $step));22 while test ${a} -lt ${b}; do 23 echo ${a}; 24 a=$((${a} ${step})); 24 25 done 25 26 26 if test $ a -eq $b; then27 echo $ a;27 if test ${a} -eq ${b}; then 28 echo ${a}; 28 29 fi; 29 30 } … … 32 33 function range_max () 33 34 { 34 declare a=$ 1;35 declare b=$ 2;36 declare step=$ 3;37 declare iter=$ 4;35 declare a=${1}; 36 declare b=${2}; 37 declare step=${3}; 38 declare iter=${4}; 38 39 39 while test $ a -lt $b -a $iter-gt 1; do40 a=$(($ a $step));41 iter=$(($ iter-1));40 while test ${a} -lt ${b} -a ${iter} -gt 1; do 41 a=$((${a} ${step})); 42 iter=$((${iter}-1)); 42 43 done; 43 44 44 if test $ a -eq $b; then45 echo $ a;45 if test ${a} -eq ${b}; then 46 echo ${a}; 46 47 fi; 47 48 48 if test $ iter-eq 1; then49 echo $ a;49 if test ${iter} -eq 1; then 50 echo ${a}; 50 51 fi; 51 52 } … … 55 56 { 56 57 # create operande 57 case $ #in58 2) range $ *"+1";;59 3) range $ *;;60 4) range_max $ *;;61 *) usage $ *58 case ${#} in 59 2) range ${*} "+1";; 60 3) range ${*} ;; 61 4) range_max ${*} ;; 62 *) usage ${*} 62 63 esac 63 64 } 64 65 65 66 #-----[ Corps ]--------------------------------------------- 66 main $ *67 main ${*}
Note: See TracChangeset
for help on using the changeset viewer.