At the input I have to enter two numbers and output their sum, difference, composition and division (to two decimal places). When dividing, for example, 1 by 3, I get .33 (and -1 by 3 gives me -.00). But I need to get 0.33, what is wrong? Bash code:
#!/bin/bash
x=$1
y=$2
if((x==0))||((y==0))
then
printf '%s' "$(( x+y )) "
printf '%s' "$(( x-y )) "
printf "$(( x*y )) "
printf "#"
else
d=$(echo "$x/$y" | bc -l)
printf '%s' "$(( x+y )) "
printf '%s' "$(( x-y )) "
printf '%s'"$(( x*y )) "
printf '%s' "$d" | cut -b 1-4
fi