bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing array to command line argument.


From: Andreas Schwab
Subject: Re: passing array to command line argument.
Date: Tue, 09 Dec 2008 18:12:07 +0100
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/22.3 (gnu/linux)

Dolphin06 <david.vauquelin@gmail.com> writes:

> I dont get it right, i always display only the first one, and i dont know how
> to write a scalar variable.
> I tried like this :
> ssh $USER@$SERVER script2 -f "${my_array[@]}"

This passes every element of my_array as a separate argument.  Also, ssh
causes the command line to be parsed a second time on the remote host,
so you have use two levels of quotes.

$ ssh $USER@$SERVER script2 -f "'${my_array[*]}'"

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]