|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (6 bit)
Join Date: Dec 2001
Location: Northern Illinois
Posts: 60
|
I am attempting to learn scripting and I have started a script in vi to calculate numbers. I want it to add, subtract, divide, and multiply integers.
I want to enter " calck plus 1 2 3 4", where plus is the operation (sub, divide, and Mult will be used as well), and the numbers are to be acted upon. I have written a test script which follows : total=0 for plus in $1 do if [ $1 = plus ] then total=`expr$total+$*` echo $total fi done But I know my expression is not right! Can anyone give me an idea of what I am doing wrong. I would appreciate any help I can receive. ( I was thinking I might be able to use Case instead of if as well) Steve |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|