I am trying
for i in {4..100}
do
is_prime=true
a=$(($i-1))
for divider in {2..$a}
do
b=$(($i % $divider)) # <-- line 9
[ $b -eq 0 ] && echo 'y' #is_prime=false
done
[ is_prime == true ] && print "${i} is prime!"
done
but I get
$ ./3_largest_prime.sh
./3_largest_prime.sh: line 9: 4 % {2..3}: syntax error: operand expected
(error token is "{2..3}")
Aucun commentaire:
Enregistrer un commentaire