Compare commits
No commits in common. "f87fb335087aad69db260ec0fa49d03917fcc143" and "073f3b182ac35d96211acc33e77c0615cc29ffda" have entirely different histories.
f87fb33508
...
073f3b182a
12
pizza.sh
12
pizza.sh
|
@ -56,21 +56,20 @@ done
|
||||||
shift $((OPTIND-1)) # shift options out from infront of the command to leave only arugment in $@
|
shift $((OPTIND-1)) # shift options out from infront of the command to leave only arugment in $@
|
||||||
|
|
||||||
function panarea {
|
function panarea {
|
||||||
DFSI=$(grep -A 1 "\[$RECIPE:ratios\]" "$PWD/pizza.txt" | tail -1 | cut -f 2) # find recipe's default flour per squre inch
|
FSI="${FSI:-2.12206590789}" # default grams of Flour per Square Inch of pan, fairly neopolitan
|
||||||
FSI="${FSI:-$DFSI}" # dont use default fsi if already set
|
|
||||||
AREA=$(echo "3.1415926535*($DIAM/2)^2" | bc -l) # bc cant exponentiate non-integer bases without -l
|
AREA=$(echo "3.1415926535*($DIAM/2)^2" | bc -l) # bc cant exponentiate non-integer bases without -l
|
||||||
SIZE=$(echo "$COUNT"*$AREA*"$FSI" | bc -l)
|
SIZE=$(echo "$COUNT"*$AREA*"$FSI" | bc)
|
||||||
arraytio
|
arraytio
|
||||||
}
|
}
|
||||||
|
|
||||||
function arraytio { # im funny portmantaus are never bad
|
function arraytio { # im funny portmantaus are never bad
|
||||||
[ -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 '||')
|
||||||
INDEX=0
|
INDEX=0
|
||||||
for RATIO in $(sed -n "/\[$RECIPE:ratios\]/,/^$/p" "$PWD/pizza.txt" | tail -n +3 | cut -f 2); do # finding [ratios] until the next blank line, removing the first two lines.
|
for RATIO in $(sed -n "/\[$RECIPE:ratios\]/,/^$/p" "$PWD/pizza.txt" | sed '/\[*.\]/d' | cut -f 2); do # finding [ratios] until the next blank line, removing the first line.
|
||||||
declare -a INGREDIENT # make arrays
|
declare -a INGREDIENT # make arrays
|
||||||
declare -a MEASURE
|
declare -a MEASURE
|
||||||
((INDEX++)) # increment the index
|
((INDEX++)) # increment the index
|
||||||
INGREDIENT[$INDEX]=$(sed -n "/\[$RECIPE:ratios\]/,/^$/p" "$PWD/pizza.txt" | tail -n +3 | cut -f 1 | sed $INDEX'!d') # same deal but itterating through the INDEX
|
INGREDIENT[$INDEX]=$(sed -n "/\[$RECIPE:ratios\]/,/^$/p" "$PWD/pizza.txt" | sed '/\[*.\]/d' | cut -f 1 | sed $INDEX'!d') # same deal but itterating through the INDEX
|
||||||
MEASURE[$INDEX]=$(echo "scale = 2; ($RATIO*$SIZE)/1" | bc -l) # we have to divide by 1 to actually apply the scale
|
MEASURE[$INDEX]=$(echo "scale = 2; ($RATIO*$SIZE)/1" | bc -l) # we have to divide by 1 to actually apply the scale
|
||||||
echo ${INGREDIENT[$INDEX]}: ${MEASURE[$INDEX]}g # actually print the calculated number with label for each INDEX
|
echo ${INGREDIENT[$INDEX]}: ${MEASURE[$INDEX]}g # actually print the calculated number with label for each INDEX
|
||||||
done
|
done
|
||||||
|
@ -98,7 +97,6 @@ case $1 in # this parses the first argument (and actually calls our main functio
|
||||||
panarea;;
|
panarea;;
|
||||||
*)
|
*)
|
||||||
read -p "Diameter of pan (in inches): " DIAM
|
read -p "Diameter of pan (in inches): " DIAM
|
||||||
DFSI=$(grep -A 1 "\[$RECIPE:ratios\]" "$PWD/pizza.txt" | tail -1 | cut -f 2)
|
read -p "Flour per square inch [2.122]: " FSI
|
||||||
read -p "Flour per square inch [$DFSI]: " FSI
|
|
||||||
panarea;;
|
panarea;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
[quick:ratios]
|
[quick:ratios]
|
||||||
fsi 2.12206
|
|
||||||
flour 1
|
flour 1
|
||||||
yeast 0.03333
|
yeast 0.03333
|
||||||
salt 0.03333
|
salt 0.03333
|
||||||
|
@ -35,7 +34,6 @@ b.ex. 0.00417
|
||||||
11: bake at 550f until done
|
11: bake at 550f until done
|
||||||
|
|
||||||
[long:ratios]
|
[long:ratios]
|
||||||
fsi 1.4
|
|
||||||
flour 1
|
flour 1
|
||||||
water 0.5
|
water 0.5
|
||||||
salt 0.02
|
salt 0.02
|
||||||
|
@ -53,4 +51,3 @@ oil 0.0625
|
||||||
7: rise for 10 minutes
|
7: rise for 10 minutes
|
||||||
8: add sauce, toppings
|
8: add sauce, toppings
|
||||||
9: bake at 550f until done
|
9: bake at 550f until done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue