![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting error in command line arguments | sunitachoudhury | Shell Programming and Scripting | 9 | 01-14-2009 09:13 PM |
| command line arguments | skooly5 | Shell Programming and Scripting | 1 | 04-07-2008 04:49 AM |
| i want to list all command line arguments except | naree | Shell Programming and Scripting | 3 | 03-31-2008 12:11 PM |
| arguments in command line | rrs | UNIX for Dummies Questions & Answers | 6 | 07-28-2006 07:44 AM |
| command line arguments | bankpro | High Level Programming | 3 | 02-02-2006 11:12 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Command Line Arguments
How do I write a script that, when the user runs it, it will give a sum of the total of the command line arguments that are numbers?
Lets say the script name is "Command" When the user types Command 10 20 30...they should see an output of 60. I think it should be something like this: for Command $1 $2 $3 $4 $5 do ((total = total + $3)) ### to keep a running total echo $total done This is purely a guess. It does not work like this but I do get some output without error messages, so I think I may be on the right track. When I try other options like creating arguments for "num" or "sum" it goes badly. Any help would be appreciated. Thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|