bash 脚本,用于查找两个连续数字的乘积,直到最大数字

bash script to find the product of two numbers in succession to each other up to a max number

大家好,我正在尝试编写一个脚本来查找两个连续数字的乘积,例如 1*2 2*3 3*4 等...直到最大数字,但我在第 14 行一直收到此错误

./test.sh: line 14: ((: 2=1: attempted assignment to non-variable (error token is "=1")

并且不确定我做错了什么 bash 非常新,任何帮助将不胜感激。

#!/bin/bash
#A script to find the products of two nonnegative numbers in succesion to each other up to a maximum 
number>
a=1
b=2
prod=$(($a*$b))
count=1
echo "Input The max number to find product of numbers in succesion with each other up to."
read maxnum
echo "Ok all the products of numbers in succesion to each other from 1 to" $maxnum  "are as follows."
for (( $b=1; $b<=$maxnum; $bb++ ))
do
        for (( $a=1; $a<$b; $a++ ))
        do
                for (( $count=1; $count<=$maxnum; ++$count ))
                do
                        echo $count". "$prod
                done
        done
done
echo "You have now reached the end of your range of products with integers in succession to each 
other"
for (($b=1;...
#     ~
#     ^

不要在作业中使用美元符号。

顺便说一句,你可以省略算术表达式中的所有美元符号。

for ((b=1; b<=maxnum; b++ ))

您确定 bb 不应该只是 b 吗?