(...) Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. (...)
"(standard_in) 1: syntax error"
#!/bin/bash
FUNKCJA() {
VAR1=$(echo "scale=2;$1+($2)" | bc)
VAR2=$(echo "scale=2;$1-($2)" | bc)
echo "Debug: VAR1 = $VAR1"
echo "Debug: VAR2 = $VAR2"
if [[ $(echo "$VAR2 > 0" | bc) -eq 1 ]]
then
echo "scale=2;($VAR1)/($VAR2)" | bc
else
echo Nie mozna dzielic przez 0
exit -1
fi
}
FUNKCJA $1 $2