[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
- What is the best to pass an array with specially characters as command line arguments?, Peng Yu, 2011/11/06
- Message not available
- Message not available
- Re: What is the best to pass an array with specially characters as command line arguments?, Clark J. Wang, 2011/11/06
- Re: What is the best to pass an array with specially characters as command line arguments?,
Peng Yu <=
- Re: What is the best to pass an array with specially characters as command line arguments?, Clark J. Wang, 2011/11/07
- Re: What is the best to pass an array with specially characters as command line arguments?, Peng Yu, 2011/11/07
- Re: What is the best to pass an array with specially characters as command line arguments?, Dennis Williamson, 2011/11/07
- Re: What is the best to pass an array with specially characters as command line arguments?, Peng Yu, 2011/11/07
Re: What is the best to pass an array with specially characters as command line arguments?, Stephane CHAZELAS, 2011/11/07