diff --git a/receipt-processor.ksh b/receipt-processor.ksh index 1d865fe..57fc264 100644 --- a/receipt-processor.ksh +++ b/receipt-processor.ksh @@ -81,6 +81,7 @@ while sleep 5; do # list up that we fetch needed ingredients printf "Fetching ingredients from receipt:\n" + printf "----------------------------------\n" i=0 while [ ${i} -lt ${num_in} ]; do in_name=$( echo "${receipt}" | jq -r .spec.ingredients[${i}].name ) @@ -92,7 +93,7 @@ while sleep 5; do if [ "x${in_remarks}" != "xnull" ]; then printf " (%s)" "${in_remarks}" fi - printf "\n" + printf "\n\n" sleep 1 i=$(( ${i} + 1 )) done @@ -107,13 +108,14 @@ while sleep 5; do # now let's iterate over that printf "\n\nProcessing the instructions:\n" + printf "----------------------------\n" i=1 - while [ ${i} -lt ${num_steps} ]; do + while [ ${i} -le ${num_steps} ]; do instruction=$( echo "${receipt}" | jq '.spec.steps[] | select(.order == '${i}') | { instruction } | join (" ")' ) printf "Step %i/%i: %s..." ${i} ${num_steps} "${instruction}" sleep $(( ${RANDOM} % 6 + 1 )) - printf "done\n" + printf "done\n\n" sleep 1 i=$(( ${i} + 1 )) done