![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check if parameter passes in contains certain string | bcunney | Shell Programming and Scripting | 9 | 3 Weeks Ago 06:54 AM |
| making script | shary | Shell Programming and Scripting | 2 | 06-03-2007 01:16 PM |
| Need help making a script | npereira | Shell Programming and Scripting | 2 | 01-06-2007 09:14 AM |
| Script to check for a file, check for 2hrs. then quit | mmarsh | UNIX for Dummies Questions & Answers | 2 | 09-16-2005 11:46 AM |
| How to check parameter variable? | negixx | Shell Programming and Scripting | 4 | 06-10-2005 02:37 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Help with making a parameter check script.
I am making a script to check the parameters, but it seems that I can't catch the parameters by loop.
[tester@test0102d test]$ cat sendmsg.sh #!/bin/sh ## Parameter Check i=0 max=$# while [ $i -lt $max ] do PARAM[${i}]=$${i} i=`expr ${i} + 1` echo ${PARAM[${i}]} done How can I get the $1, $2, $3 by loop and set their values to PARAM[${i}]? Thank u in advance. |
| Forum Sponsor | ||
|
|
|
|||
|
Thank u in advance!
Test OK ! [tester@test0102d test]$ cat sendmsg.sh #!/bin/sh ## Parameter Check cnt=0 for i in $@ do PARAM[${cnt}]=${i} echo ${PARAM[${cnt}]} cnt=`expr ${cnt} + 1` done [tester@test0102d test]$ sh sendmsg.sh test test1 test2 test test1 test2 |
|||
| Google UNIX.COM |