A
A
Andrey2019-02-17 12:57:36
bash
Andrey, 2019-02-17 12:57:36

What is wrong in bash code?

Define a triangle. What's wrong? :(

#!/bin/bash
read a
read b
read c
if [ $(($a + $b)) -le $c ] || [ $(($a + $c)) -le $b ] || [ $(($b + $c)) -le $a ]
then
echo "ERROR"
elif [ $a -ne $b ] $$ [ $a -ne $c ] $$ [ $b -ne $c ]
then
echo "SCALENE"
elif [ $a -eq $b ] $$ [ $b -eq $c ]
then
echo "EQUILATERAL"
else
echo "ISOSCELES"
fi
fi
fi

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitsliputsli, 2019-02-17
@Vitsliputsli

In addition to extra fi instead of $$, it probably meant &&

J
jcmvbkbc, 2019-02-17
@jcmvbkbc

$$replace with &&.

Q
q2zoff, 2019-02-17
@q27off

Without delving into the problem and the solution, at least in the fact that there are two extra fi.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question