![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing args to URL to retrieve a file | ToniS | Shell Programming and Scripting | 1 | 07-17-2008 11:35 AM |
| command line args 2 | skooly5 | UNIX for Dummies Questions & Answers | 2 | 04-06-2008 09:36 PM |
| command line args | skooly5 | UNIX for Dummies Questions & Answers | 2 | 04-06-2008 07:46 PM |
| Command line args | enuenu | High Level Programming | 2 | 05-29-2007 12:19 AM |
| required command line args | yoi2hot4ya | UNIX for Dummies Questions & Answers | 6 | 06-02-2005 06:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to retrieve command line args one by on.
Hi,
I have to store all the command line arguments into an array. I have the following code. ********************** Code:
#! /bin/sh
set -A arr_no_updates
i=1
while [ i -le $# ]
do
arr_no_updates[i]=$($i)
echo ${arr_no_updates[$i]}
i=$(($i+1))
done
But i could not assign the argumen values. please help me!! In addition, I wish to learn Functions writing in shell script. pls advice me some documrnts or websites. I am very much new to shell scripts. Pls help me to learn. Thank you all in advance.. -----Post Update----- I have found the below way.... please convey me ,if any other better way of doing this. Thanks.. ************************** Code:
set -A arr_no_updates
echo $@
i=1
for arr in $@
do
echo $arr
i=$(($i+1))
done
Last edited by vidyadhar85; 05-25-2009 at 11:23 PM.. Reason: code tags added |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|