rename DIAM to WIDTH

This commit is contained in:
ida schmidt 2023-08-15 22:00:24 -07:00
parent 04f185051d
commit c62e20d251

View file

@ -66,7 +66,7 @@ shift $((OPTIND-1)) # shift options out from infront of the command to leave onl
function panarea {
DFSI=$(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | grep -A 1 "\[$RECIPE:ratios\]" | tail -n -1 | cut -f 2-) # find recipe's default flour per squre inch
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*($WIDTH/2)^2" | bc -l) # bc cant exponentiate non-integer bases without -l
SIZE=$(echo "$COUNT"*$AREA*"$FSI" | bc -l)
arraytio
}
@ -88,7 +88,7 @@ function arraytio { # im funny portmantaus are never bad
unset SIZE
unset FSI
unset AREA
unset DIAM
unset WIDTH
}
case $1 in # this parses the first argument (and actually calls our main functions), the units need to be removed before bc will accept it
@ -96,16 +96,16 @@ case $1 in # this parses the first argument (and actually calls our main functio
SIZE=$(echo $1 | sed s/g//g)
arraytio;;
+([0-9])?(.)*([0-9])\")
DIAM=$(echo $1 | sed s/\"//g)
WIDTH=$(echo $1 | sed s/\"//g)
panarea;;
+([0-9])?(.)*([0-9])inch)
DIAM=$(echo $1 | sed s/inch//g)
WIDTH=$(echo $1 | sed s/inch//g)
panarea;;
+([0-9])?(.)*([0-9])in)
DIAM=$(echo $1 | sed s/in//g)
WIDTH=$(echo $1 | sed s/in//g)
panarea;;
*)
read -p "Diameter of pan (in inches): " DIAM
read -p "Diameter of pan (in inches): " WIDTH
DFSI=$(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | grep -A 1 "\[$RECIPE:ratios\]" | tail -n -1 | cut -f 2-)
read -p "Flour per square inch [$DFSI]: " FSI
panarea;;