PI="3,1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679" i=4 echo -n "PI ~= " echo ${PI:0:10} while true; do echo "Press and type a PI approximation." read -n 1 clear read -p "3," -e mypi i=1 mypi=3,$mypi while [ "${mypi:$i:1}" = "${PI:$i:1}" ]; do i=$(($i + 1)) done echo ${PI:0:$i}""${PI:$i:2}"" echo -n "($(($i-1))) " done