Compare commits
No commits in common. "74b7c0211aebd4ff75598805514a87b05834dff2" and "ef48cc5cb4b1048b95689f424b3513362c4af066" have entirely different histories.
74b7c0211a
...
ef48cc5cb4
44
pizza.sh
44
pizza.sh
|
@ -1,31 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
FSI=2.12206590789 # grams of Flour per Square Inch of pan
|
|
||||||
|
|
||||||
function pizzahelp {
|
FSI=2.12206590789 # grams of flour per square inch of pan
|
||||||
echo "Pizza Calculator: The pizza script you never asked for"
|
|
||||||
echo
|
|
||||||
echo "Usage: ./pizza.sh [-h] [-f] [<flour weight>g|<pan diameter>(in|inch|\")]"
|
|
||||||
echo "Options:"
|
|
||||||
echo " -h Print this help"
|
|
||||||
echo " -f <N> Set flour per square inch"
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
while getopts ":hf:" option; do
|
|
||||||
case $option in
|
|
||||||
h)
|
|
||||||
pizzahelp
|
|
||||||
exit;;
|
|
||||||
f)
|
|
||||||
FSI=$OPTARG
|
|
||||||
shift 2;;
|
|
||||||
\?)
|
|
||||||
echo "Error: Invalid option"
|
|
||||||
exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
function panarea {
|
function panarea {
|
||||||
|
read -p "Diameter of pan (in inches): " DIAM
|
||||||
AREA=$(echo "3.1415926535*($DIAM/2)^2" | bc)
|
AREA=$(echo "3.1415926535*($DIAM/2)^2" | bc)
|
||||||
SIZE=$(echo $AREA*$FSI | bc)
|
SIZE=$(echo $AREA*$FSI | bc)
|
||||||
calcratio
|
calcratio
|
||||||
|
@ -41,20 +19,4 @@ function calcratio {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
panarea
|
||||||
*g)
|
|
||||||
SIZE=$(echo $1 | sed s/g//g)
|
|
||||||
calcratio;;
|
|
||||||
*\")
|
|
||||||
DIAM=$(echo $1 | sed s/\"//g)
|
|
||||||
panarea;;
|
|
||||||
*inch)
|
|
||||||
DIAM=$(echo $1 | sed s/inch//g)
|
|
||||||
panarea;;
|
|
||||||
*in)
|
|
||||||
DIAM=$(echo $1 | sed s/in//g)
|
|
||||||
panarea;;
|
|
||||||
*)
|
|
||||||
read -p "Diameter of pan (in inches): " DIAM
|
|
||||||
panarea;;
|
|
||||||
esac
|
|
||||||
|
|
Loading…
Reference in New Issue