Link to home
Start Free TrialLog in
Avatar of adamooten
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
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
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