Compare commits

..

No commits in common. "b93a0248eb72c3400fe8e34f791b411d2ab0750c" and "72b735026cfcb9b8610f9f4aa174282f22a4138b" have entirely different histories.

View file

@ -31,7 +31,7 @@ function pizzarecipe {
echo " 7: rise for 10 minutes"
echo " 8: add sauce, toppings"
echo " 9: bake at 550f until done"
echo
echo ""
}
while getopts ":hrf:" option; do # loop through options, casing them
@ -58,13 +58,13 @@ function panarea {
}
function calcratio { # this is mildly hacky
[ -n SIZE ] || read -p "Grams of flour: " SIZE # test ([) will send a non-zero exit code on if $SIZE doesnt exist, tripping the or (the '||')
[ -n SIZE ] || read -p "Grams of flour: " SIZE # test will send a non-zero exit code on if $SIZE doesnt exist, tripping the or (the '||')
LABEL=0
for RATIO in $(sed -n '/\[ratios\]/,/^$/p' "$PWD/pizza.txt" | sed '/\[*.\]/d' | cut -f 2); do # finding [ratios] until the next blank line, removing the first line.
for RATIO in $(grep 'ratios' -A 8 "$PWD/pizza.txt" | sed /\\[*.\\]/d | cut -f 2); do # finding [ratios] +8 tailing lines, removing the first.
((LABEL++))
sed -n '/\[ratios\]/,/^$/p' "$PWD/pizza.txt" | sed '/\[*.\]/d' | cut -f 1 | sed $LABEL'!d' # same deal but itterating through the labels
grep 'ratios' -A 8 "$PWD/pizza.txt" | sed /\\[*.\\]/d | cut -f 1 | sed $LABEL'!d' # same deal but itterating through the labels
echo "scale = 2; ($RATIO*$SIZE)/1" | bc -l # actually print the calculated number for each label
done # we have to divide by 1 to get the base to reset to actually apply the scale
done # we have to divide by 1 to.get the base to reset to actually apply the scale
# cleanup
unset LABEL
unset RATIO