(Added back the bash list) On Mon, Nov 7, 2011 at 11:50 AM, Peng Yu <pengyu...@gmail.com> wrote:
> On Sun, Nov 6, 2011 at 9:30 PM, Clark J. Wang <dearv...@gmail.com> wrote: > > On Mon, Nov 7, 2011 at 11:02 AM, Peng Yu <pengyu...@gmail.com> wrote: > >> > >> 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 pass the 6 arguments. > > > > v=" a b c ( a'b | " > > a=( $v ) > > echo "${a[@]}" > There's a @ char here. > > > > And you may need to temporariliy enable the noglob option before that. > > Not working. See below. Also, 'echo "${a[@]}"' will only pass 1 > argument to echo, I want to pass 6 separate arguments to echo. > > ~$ cat main1.sh > #!/usr/bin/env bash > > set -o noglob > verbatim_string=" a b c ( a'b | " > > args=( $verbatim_string ) > set +o noglob > > echo "${args}" > ~$ ./main1.sh > a > > > > > -- > Regards, > Peng >