首先,我不仅是 emacs 的新手,而且是 UNIX 的新手。我试过写:
#!/bin/bash
for i in {1..20}
do
j=(5*$i)+1
echo "$j"
done
结果:(5*1)+1(5*2)+1(5*3)+1(5*4)+1(5*5)+1(5*6)+1(5*7) +1 (5*8)+1 (5*9)+1 (5*10)+1 (5*11)+1 (5*12)+1 (5*13)+1 (5*14)+ 1(5*15)+1(5*16)+1(5*17)+1(5*18)+1(5*19)+1(5*20)+1
我实际上如何求和?
答案1
通过管道将其传输到 bc,很好的简短简单的答案;
echo "$j" | bc