Compare commits
No commits in common. "b93a0248eb72c3400fe8e34f791b411d2ab0750c" and "72b735026cfcb9b8610f9f4aa174282f22a4138b" have entirely different histories.
b93a0248eb
...
72b735026c
1 changed files with 5 additions and 5 deletions
10
pizza.sh
10
pizza.sh
|
@ -31,7 +31,7 @@ function pizzarecipe {
|
||||||
echo " 7: rise for 10 minutes"
|
echo " 7: rise for 10 minutes"
|
||||||
echo " 8: add sauce, toppings"
|
echo " 8: add sauce, toppings"
|
||||||
echo " 9: bake at 550f until done"
|
echo " 9: bake at 550f until done"
|
||||||
echo
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":hrf:" option; do # loop through options, casing them
|
while getopts ":hrf:" option; do # loop through options, casing them
|
||||||
|
@ -58,13 +58,13 @@ function panarea {
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcratio { # this is mildly hacky
|
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
|
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++))
|
((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
|
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
|
# cleanup
|
||||||
unset LABEL
|
unset LABEL
|
||||||
unset RATIO
|
unset RATIO
|
||||||
|
|
Loading…
Add table
Reference in a new issue