Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How To Pass an Array Variable Post 302232472 by Ikon on Thursday 4th of September 2008 01:48:21 PM
Old 09-04-2008
script1
Code:
#!/bin/sh

var1="why"
var2="is"
var3="this so hard"
./script2.sh $var1 $var2 "${var3[@]}"

exit 0

script2
Code:
#!/bin/sh

var1=$1
var2=$2
ar1=($3)


echo "var1: $var1"
echo "var2: $var2"
for var in ${ar1[@]}
do
echo "array: $var"
done
exit 0

Code:
$ ./ script1

var1: why
var2: is
array: this
array: so
array: hard

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can we pass array with call by value in function

I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function (1 Reply)
Discussion started by: ranjithpr
1 Replies

2. Shell Programming and Scripting

How to pass ksh array to oracle

Hi all.. Does anyone know have an example of passing the contents of a ksharray to oracle? basically I am looking to loop through the contents of a file and store each line into a bash ksh. Once i have this I can then pass the array into an oracle procedure that accepts an array as an... (1 Reply)
Discussion started by: kiranlalka
1 Replies

3. Programming

[ C ] multidemensional array pass to functions

Please excuse my ineptitude for a bit as I've been spoiled for the past few months with only writing perl code instead of C. So ok, I've been thinking about some code to change the crc32 values that are held within central directory headers of zip files. Because I'm lazy I decided to just... (3 Replies)
Discussion started by: VRoemer
3 Replies

4. UNIX for Dummies Questions & Answers

How to pass array as an arguement ?

Hi experts, I am here again with another Issue. I need to pass the array as parameter / argument to another script. I tried it as follows . ( I got this idea from the link ) $ cat test1.sh #! /usr/bin/ksh set -a arr1 echo "...In Test1...." arr1="APPS_DEV" arr1="TEST_DEV" echo... (16 Replies)
Discussion started by: rajavu
16 Replies

5. Shell Programming and Scripting

How to pass an array as arg to a script..

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 (3 Replies)
Discussion started by: little_wonder
3 Replies

6. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

7. Shell Programming and Scripting

Pass awk array variable to shell

Hi, all suppose I have following myfile (delimited by tab) aa bb cc dd ee ffand I have following awk command: awk 'BEGIN{FS="\t"}{AwkArrayVar_1=$1;AwkArrayVar_2=$2};END{for(i=0; i<NR; i++) print i, AwkArrayVar_1, AwkArrayVar_2,}' myfileMy question is: how can I assign the awk array... (7 Replies)
Discussion started by: littlewenwen
7 Replies

8. UNIX for Dummies Questions & Answers

Pass array to shell and print

How do i pass an array from test4.sh to a function in another shell script test5.sh, basically i am sourcing the test5.sh in test4.sh and printing the contents, but not working below are my trial scripts, please help, thank you. #!/bin/bash # /usr/local/dw/archive/test5.sh print_array() {... (5 Replies)
Discussion started by: Ariean
5 Replies

9. Shell Programming and Scripting

Pass array to a function and display the array

Hi All I have multiple arrays like below. set -A val1 1 2 4 5 set -A val2 a b c d . . . Now i would like to pass the individual arrays one by one to a function and display/ do some action. Note : I am using ksh Can you please advise any solution... Thanks in advance. (7 Replies)
Discussion started by: Girish19
7 Replies

10. UNIX for Dummies Questions & Answers

How to pass first array value?

Hi, I am creating filesystem for block device, but I want to pass array value one by one acording to block device count. $tmp1 = block device count 3 $blockdevice = So I want to first pass sdb1 alone in loop, how to take only block device seprately from $blockdevice array. (1 Reply)
Discussion started by: stew
1 Replies
IDA(4)							   BSD Kernel Interfaces Manual 						    IDA(4)

NAME
ida -- Compaq Intelligent Drive Array Controllers SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device scbus device ida Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): ida_load="YES" DESCRIPTION
The Compaq Intelligent Drive Array (IDA) technology is used to distribute data across an array of hard drives. It unites these hard drives into one or more high-performance logical drives. The drive array is managed by an array controller. These controllers have the ability to provide fault tolerance for the connected drives and optionally provide write cache for the logical drives. It is also possible for an application to access the SCSI bus subsystem directly by using the pass-through interface. HARDWARE
The following controllers are supported by the ida driver: o Compaq SMART Array 221 o Compaq Integrated SMART Array Controller o Compaq SMART Array 4200 o Compaq SMART Array 4250ES o Compaq SMART 3200 Controller o Compaq SMART 3100ES Controller o Compaq SMART-2/DH Controller o Compaq SMART-2/SL Controller o Compaq SMART-2/P Controller o Compaq SMART-2/E Controller o Compaq SMART Controller IMPLEMENTATION NOTES
Extreme caution should be exercised when using the pass-through interface. It is possible to interfere with normal system I/O and cause hangs if pass-through is used to an active device. Pass-through should only be used to a device that is otherwise quiescent. SEE ALSO
cam(4), pass(4), xpt(4), camcontrol(8) AUTHORS
The ida driver was written by Jonathan Lemon <jlemon@FreeBSD.org> and Matthew N. Dodd <mdodd@FreeBSD.org>. This manual page was written by Tom Rhodes <trhodes@FreeBSD.org>. BSD
August 8, 2004 BSD
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy