+ 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.

27th Aug 2025, 6:11 PM
Sharon Ureh Odu
Sharon Ureh Odu - avatar
3 Respuestas
+ 1
bash does not support floating-point arithmetic by default, but you can use external tools for this
27th Aug 2025, 6:57 PM
Mihaly Nyilas
Mihaly Nyilas - avatar
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.
27th Aug 2025, 9:13 PM
Sharon Ureh Odu
Sharon Ureh Odu - avatar