adamooten
asked on
Unix command procedure help........
I am trying to write a command procedure to compute the sum from 1 squared to $i squared. I am very new to Unix, & trying to teach myself. Here is what I have, and it does not work:
set $i=0
set $sum=0
for $i -lt 1
do
sum='expr $sum +'$i'*'$i'
i='expr $i-1'
done
echo $sum
I don't know how to ask the user for the i variable or if I am declaring them right???
Be nice I'm a Unix newbie...
Adam
set $i=0
set $sum=0
for $i -lt 1
do
sum='expr $sum +'$i'*'$i'
i='expr $i-1'
done
echo $sum
I don't know how to ask the user for the i variable or if I am declaring them right???
Be nice I'm a Unix newbie...
Adam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by ozo
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
liddler
EE Cleanup Volunteer