![]() |
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 |
| How to pass C array as input to Shell script | arunkumar_mca | High Level Programming | 1 | 04-30-2009 10:25 AM |
| How to pass array as an arguement ? | rajavu | UNIX for Dummies Questions & Answers | 16 | 01-16-2009 01:33 AM |
| How to pass ksh array to oracle | kiranlalka | Shell Programming and Scripting | 1 | 12-05-2008 09:27 AM |
| How To Pass an Array Variable | msb65 | UNIX for Dummies Questions & Answers | 9 | 09-04-2008 01:48 PM |
| Can we pass array with call by value in function | ranjithpr | Shell Programming and Scripting | 1 | 12-26-2007 12:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
Please guide to pass an array as a arg to a script... for example, I have a script small.sh to find the small no of given arg as below... #! /bin/sh # this script is for finding the small number set -A arr_no_updates small=$1 i=1 for arr in $@ do if [ $arr -ne 0 ] then if [ $arr -le small ] then small=$arr fi fi i=$(($i+1)) done echo $small Now i like to use this script for muliple times in another script called secondscript.sh please help me on the following 1.how to call the small.sh 2.how to pass the array as arg 3.how to get the result I tried for the non array codes, i could get the perfect result with the below lines.. chmod 777 small.sh ./small.sh 10 20 30 please help me hw to arg a array.. Thankyou all in advance... |
|
||||
|
Hi vidyadhar85,
Sorry if my question confuse you.. actually i want to pass an array as argument.. please find the script named small.sh.. This script is to find small no from a list.. i want to call this small.sh in another script secondscript.sh, where as i wish to pass a array as argument.. for ex, if i have 3 arrays in secondscript.sh. i want to use small.sh to find the smallest no of each array.. hope the scenario is clear now. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|