#!/usr/bin/env bash x=$1 y=$2 distance=$(echo "sqrt($x^2 + $y^2)" | bc -l) if [[ $# -ne 2 ]]; then echo "# there is _some_ output" exit 1 fi if ! [[ $x =~ ^[+-]?[0-9]+(\.[0-9]+)?$ ]] || ! [[ $y =~ ^[+-]?[0-9]+(\.[0-9]+)?$ ]]; then echo "# there is _some_ output" exit 1 fi if (( $(echo "$distance > 10" | bc -l) )); then echo "0" elif (( $(echo "$distance > 5" | bc -l) )); then echo "1" elif (( $(echo "$distance > 1" | bc -l) )); then echo "5" else echo "10" fi