Reputation: 17
I don't understand why this isn't running. I looked up the syntax for while loops and I think I'm doing it right. Help, please.
#!/bin/bash
#
x=0 # init x=0
i=1
while[ $i -le $1 ] # while(i<=userInput)
do
s=`expr $i \* $i` # s=i*i
x=`expr $s + $x`
i=`expr $i + 1` # i=i+1
done
echo x=$x
Upvotes: 0
Views: 37