0

i'm writting a script with an outer loop and two inner loop, i must not be correctly typing out the syntax but i want to write an expression for my first inner loop where i raise $2 to the power of j + 1: $2^(j+1)

This is not a complete script:

    for((d=0;d<=($2**($j+1));d++)) <----
do

done

What is the proper way to write such an expression in a for loop?

4

1 回答 1

0

你可以试试

for((d=0;d<=$(($2**($j+1)));d++)) <----

$((在表达式周围签名并加倍。

取决于bash您使用的版本。有时你不需要$...

于 2013-02-11T00:13:23.880 回答