Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Clark J. Wang
On Mon, Nov 7, 2011 at 12:56 PM, Peng Yu wrote: > Hi Clark, > > >> > v=" a b c ( a'b | " > >> > a=( $v ) > >> > echo "${a[@]}" > > > > There's a @ char here. > > I see. It's my mistake. > > But I want to pass the 6 short arguments instead of 1 long argument to > echo. What do you mean by "1 lo

Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Peng Yu
Hi Clark, >> > v="  a b c ( a'b | " >> > a=( $v ) >> > echo "${a[@]}" > > There's a @ char here. I see. It's my mistake. But I want to pass the 6 short arguments instead of 1 long argument to echo. (echo is just an example, it can be any command that accepts multiple arguments.) ~$ cat ./main1

Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Clark J. Wang
(Added back the bash list) On Mon, Nov 7, 2011 at 11:50 AM, Peng Yu wrote: > On Sun, Nov 6, 2011 at 9:30 PM, Clark J. Wang wrote: > > On Mon, Nov 7, 2011 at 11:02 AM, Peng Yu wrote: > >> > >> Hi, > >> > >> Suppose that I have a verbatim string " a b c ( a'b | " in bash, and > >> I want to pas

What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Peng Yu
Hi, Suppose that I have a verbatim string " a b c ( a'b | " in bash, and I want to pass them as 6 command line arguments. I have to the following conversion using quoteverb.sed to pass the 6 arguments correctly to echo, which is a little bit cumbersome. I'm wondering if there is any better way to