0

I'm new to bash, I've a question about reading data and using index in bash.

I've a file a.txt. Inside there are 10 lines, each line with a single value (1 2 3 2 4 4 2 1 4 2).

First I need to read the file, and output "Bingo" if the value equal to 2.

The codes I wrote are:

value=$( <a.txt)
for n in ${value[@]} ; do
    if (( $n == 2 )) ; then
    echo $"Bingo"
fi
done

But it returned == 2 ")syntax error: invalid arithmetic operator (error token is "

Any comment is appreciated.

Kun
  • 1

0 Answers0