+ 1
Bash Scripting
I just started Kali and I'm learning bash scripting at the moment. Please how can I use float numbers? I'm really confused about the concept.
3 odpowiedzi
+ 1
bash does not support floating-point arithmetic by default, but you can use external tools for this
0
please what kind of external tools?
Let's say I'm trying to calculate the area of a trapezium
echo "Area of a Trapezium"
read -p "length on one side" a
read -p "length on the other side" b
read -p "height of the trapezium" h
echo "Area of trapezium: $(( 1/2 * (a+b) * h" | bc))
What's wrong with the code?
I know it's incorrect but I don't know how to correct it.