bug-bash
[Top][All Lists]
Advanced

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

Re: What is the best to pass an array with specially characters as comma


From: Peng Yu
Subject: Re: What is the best to pass an array with specially characters as command line arguments?
Date: Sun, 6 Nov 2011 22:56:12 -0600

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.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 b c ( a'b |


-- 
Regards,
Peng



reply via email to

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