[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: passing array to command line argument.
From: |
Dolphin06 |
Subject: |
Re: passing array to command line argument. |
Date: |
Tue, 9 Dec 2008 06:51:03 -0800 (PST) |
I did the change but i still have only the first element displaying. I must
say that i m using ssh to call script2 on remote server so maybe it is the
problem :
script1
ssh $USER@$SERVER script2 -f ${my_array[@]} -d ${my_other_array[@]}
and on script2 it only echoes the first element of both arrays.
Chet Ramey wrote:
>
> Dolphin06 wrote:
>> Hello,
>> So how can i pass the entire array, i m new to shell scripting so i do
>> not
>> really understand when you talk about unsubscripted word expansion
>
> Since programs only take a list of strings as arguments, you have to
> expand
> the array to a list of values. The "${array[@]}" expansion can do that.
> Expanding an array variable without using a subscript (${array} as opposed
> to ${array[subscript]}) expands to the first element.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>
> Chet Ramey, ITS, CWRU chet@case.edu
> http://cnswww.cns.cwru.edu/~chet/
>
>
>
>
--
View this message in context:
http://www.nabble.com/passing-array-to-command-line-argument.-tp20914576p20916101.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.