* [gentoo-user] [OT] bash script error
@ 2011-05-09 5:44 Xi Shen
2011-05-09 6:43 ` Nils Andresen
` (3 more replies)
0 siblings, 4 replies; 17+ messages in thread
From: Xi Shen @ 2011-05-09 5:44 UTC (permalink / raw
To: gentoo-user
It is not specific to Gentoo. But do not know where to search or post it :)
My script looks like:
url="http://mypage"
curl_opts="-x ''"
curl $url -d \"mydata\" $curl_opts
If I execute it, I got an error from curl, saying it cannot resolve
the proxy ''.
But If I modify the script to:
url="http://mypage"
curl $url -d \"mydata\" -x ''
It works fine.
I guess there's something wrong with the argument expansion. Just do
not know how to fix it. Please help.
--
Best Regards,
Xi Shen (David)
http://twitter.com/davidshen84/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 5:44 [gentoo-user] [OT] bash script error Xi Shen
@ 2011-05-09 6:43 ` Nils Andresen
2011-05-09 7:48 ` Xi Shen
2011-05-09 7:52 ` Kfir Lavi
2011-05-09 8:31 ` Pandu Poluan
` (2 subsequent siblings)
3 siblings, 2 replies; 17+ messages in thread
From: Nils Andresen @ 2011-05-09 6:43 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
Hi,
have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
Nils
2011/5/9 Xi Shen <davidshen84@googlemail.com>
> I guess there's something wrong with the argument expansion. Just do
> not know how to fix it. Please help.
>
>
[-- Attachment #2: Type: text/html, Size: 552 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 6:43 ` Nils Andresen
@ 2011-05-09 7:48 ` Xi Shen
2011-05-09 7:52 ` Kfir Lavi
1 sibling, 0 replies; 17+ messages in thread
From: Xi Shen @ 2011-05-09 7:48 UTC (permalink / raw
To: gentoo-user
yes, you are right.
+ curl_opts='-x '\'''\'''
the "-x ''" expands to too many quotes. I tried to replace the
double-quotes to single-quotes, but still not working.
any idea how to fix this?
On Mon, May 9, 2011 at 2:43 PM, Nils Andresen <nils@nils-andresen.de> wrote:
> Hi,
> have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
>
> Nils
>
> 2011/5/9 Xi Shen <davidshen84@googlemail.com>
>>
>> I guess there's something wrong with the argument expansion. Just do
>> not know how to fix it. Please help.
>>
>
--
Best Regards,
Xi Shen (David)
http://twitter.com/davidshen84/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 6:43 ` Nils Andresen
2011-05-09 7:48 ` Xi Shen
@ 2011-05-09 7:52 ` Kfir Lavi
2011-05-09 8:14 ` Xi Shen
1 sibling, 1 reply; 17+ messages in thread
From: Kfir Lavi @ 2011-05-09 7:52 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
On Mon, May 9, 2011 at 9:43 AM, Nils Andresen <nils@nils-andresen.de> wrote:
> Hi,
> have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
>
> Nils
>
>
> 2011/5/9 Xi Shen <davidshen84@googlemail.com>
>
>> I guess there's something wrong with the argument expansion. Just do
>> not know how to fix it. Please help.
>>
>> You need to change:
- curl_opts="-x ''"
+ curl_opts=-x ""
Run your program with bash -x as Nils said, and you will see the expansion.
Kfir
[-- Attachment #2: Type: text/html, Size: 1242 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 7:52 ` Kfir Lavi
@ 2011-05-09 8:14 ` Xi Shen
2011-05-09 8:23 ` Xi Shen
2011-05-09 8:30 ` Pandu Poluan
0 siblings, 2 replies; 17+ messages in thread
From: Xi Shen @ 2011-05-09 8:14 UTC (permalink / raw
To: gentoo-user
yes, i use the '-x' option, and i can see the expansion now. and i
found there are too many quotes.
i tried curl_opts=-x "", does not work.
On Mon, May 9, 2011 at 3:52 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>
>
> On Mon, May 9, 2011 at 9:43 AM, Nils Andresen <nils@nils-andresen.de> wrote:
>>
>> Hi,
>> have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
>>
>> Nils
>>
>> 2011/5/9 Xi Shen <davidshen84@googlemail.com>
>>>
>>> I guess there's something wrong with the argument expansion. Just do
>>> not know how to fix it. Please help.
>>>
> You need to change:
> - curl_opts="-x ''"
> + curl_opts=-x ""
>
> Run your program with bash -x as Nils said, and you will see the expansion.
>
> Kfir
>
--
Best Regards,
Xi Shen (David)
http://twitter.com/davidshen84/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 8:14 ` Xi Shen
@ 2011-05-09 8:23 ` Xi Shen
2011-05-09 8:30 ` Pandu Poluan
1 sibling, 0 replies; 17+ messages in thread
From: Xi Shen @ 2011-05-09 8:23 UTC (permalink / raw
To: gentoo-user
if i use -x '', or -x "", it expands to -x. the quotes are removed as
they are empty.
if i use -x \'\', the expanded quotes are quoted again...resulting too
many quotes
it is driving me crazy o_O! please help.
On Mon, May 9, 2011 at 4:14 PM, Xi Shen <davidshen84@googlemail.com> wrote:
> yes, i use the '-x' option, and i can see the expansion now. and i
> found there are too many quotes.
>
> i tried curl_opts=-x "", does not work.
>
>
> On Mon, May 9, 2011 at 3:52 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>>
>>
>> On Mon, May 9, 2011 at 9:43 AM, Nils Andresen <nils@nils-andresen.de> wrote:
>>>
>>> Hi,
>>> have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
>>>
>>> Nils
>>>
>>> 2011/5/9 Xi Shen <davidshen84@googlemail.com>
>>>>
>>>> I guess there's something wrong with the argument expansion. Just do
>>>> not know how to fix it. Please help.
>>>>
>> You need to change:
>> - curl_opts="-x ''"
>> + curl_opts=-x ""
>>
>> Run your program with bash -x as Nils said, and you will see the expansion.
>>
>> Kfir
>>
>
>
>
> --
> Best Regards,
> Xi Shen (David)
>
> http://twitter.com/davidshen84/
>
--
Best Regards,
Xi Shen (David)
http://twitter.com/davidshen84/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 8:14 ` Xi Shen
2011-05-09 8:23 ` Xi Shen
@ 2011-05-09 8:30 ` Pandu Poluan
1 sibling, 0 replies; 17+ messages in thread
From: Pandu Poluan @ 2011-05-09 8:30 UTC (permalink / raw
To: gentoo-user
(Forgive my top-posting)
try:
curl_opts="-x \'\'"
Rgds,
On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
> yes, i use the '-x' option, and i can see the expansion now. and i
> found there are too many quotes.
>
> i tried curl_opts=-x "", does not work.
>
>
> On Mon, May 9, 2011 at 3:52 PM, Kfir Lavi <lavi.kfir@gmail.com> wrote:
>>
>>
>> On Mon, May 9, 2011 at 9:43 AM, Nils Andresen <nils@nils-andresen.de>
>> wrote:
>>>
>>> Hi,
>>> have you tried "/bin/bash -x your.script.sh" - see what get's expanded ?
>>>
>>> Nils
>>>
>>> 2011/5/9 Xi Shen <davidshen84@googlemail.com>
>>>>
>>>> I guess there's something wrong with the argument expansion. Just do
>>>> not know how to fix it. Please help.
>>>>
>> You need to change:
>> - curl_opts="-x ''"
>> + curl_opts=-x ""
>>
>> Run your program with bash -x as Nils said, and you will see the
>> expansion.
>>
>> Kfir
>>
>
>
>
> --
> Best Regards,
> Xi Shen (David)
>
> http://twitter.com/davidshen84/
>
>
--
--
Pandu E Poluan - IT Optimizer
My website: http://pandu.poluan.info/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 5:44 [gentoo-user] [OT] bash script error Xi Shen
2011-05-09 6:43 ` Nils Andresen
@ 2011-05-09 8:31 ` Pandu Poluan
2011-05-09 9:00 ` Xi Shen
2011-05-09 12:57 ` BRM
2011-05-09 14:16 ` Kevin McCarthy
3 siblings, 1 reply; 17+ messages in thread
From: Pandu Poluan @ 2011-05-09 8:31 UTC (permalink / raw
To: gentoo-user
(Again, sorry for top-posting)
BTW, there are lots of bash gurus in stackovervlow.com. My handle
there is 'pepoluan'.
Rgds,
On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
> It is not specific to Gentoo. But do not know where to search or post it :)
>
> My script looks like:
>
> url="http://mypage"
> curl_opts="-x ''"
> curl $url -d \"mydata\" $curl_opts
>
> If I execute it, I got an error from curl, saying it cannot resolve
> the proxy ''.
>
> But If I modify the script to:
>
> url="http://mypage"
> curl $url -d \"mydata\" -x ''
>
> It works fine.
>
> I guess there's something wrong with the argument expansion. Just do
> not know how to fix it. Please help.
>
>
> --
> Best Regards,
> Xi Shen (David)
>
> http://twitter.com/davidshen84/
>
>
--
--
Pandu E Poluan - IT Optimizer
My website: http://pandu.poluan.info/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 8:31 ` Pandu Poluan
@ 2011-05-09 9:00 ` Xi Shen
2011-05-09 9:25 ` Kfir Lavi
0 siblings, 1 reply; 17+ messages in thread
From: Xi Shen @ 2011-05-09 9:00 UTC (permalink / raw
To: gentoo-user
i tried that already. not working. i will try the stackoverflow.com. thanks
On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@poluan.info> wrote:
> (Again, sorry for top-posting)
>
> BTW, there are lots of bash gurus in stackovervlow.com. My handle
> there is 'pepoluan'.
>
> Rgds,
>
>
> On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
>> It is not specific to Gentoo. But do not know where to search or post it :)
>>
>> My script looks like:
>>
>> url="http://mypage"
>> curl_opts="-x ''"
>> curl $url -d \"mydata\" $curl_opts
>>
>> If I execute it, I got an error from curl, saying it cannot resolve
>> the proxy ''.
>>
>> But If I modify the script to:
>>
>> url="http://mypage"
>> curl $url -d \"mydata\" -x ''
>>
>> It works fine.
>>
>> I guess there's something wrong with the argument expansion. Just do
>> not know how to fix it. Please help.
>>
>>
>> --
>> Best Regards,
>> Xi Shen (David)
>>
>> http://twitter.com/davidshen84/
>>
>>
>
>
> --
> --
> Pandu E Poluan - IT Optimizer
> My website: http://pandu.poluan.info/
>
>
--
Best Regards,
Xi Shen (David)
http://twitter.com/davidshen84/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 9:00 ` Xi Shen
@ 2011-05-09 9:25 ` Kfir Lavi
2011-05-09 10:36 ` Alex Schuster
0 siblings, 1 reply; 17+ messages in thread
From: Kfir Lavi @ 2011-05-09 9:25 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]
On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@googlemail.com> wrote:
> i tried that already. not working. i will try the stackoverflow.com.
> thanks
>
>
> On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@poluan.info> wrote:
> > (Again, sorry for top-posting)
> >
> > BTW, there are lots of bash gurus in stackovervlow.com. My handle
> > there is 'pepoluan'.
> >
> > Rgds,
> >
> >
> > On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
> >> It is not specific to Gentoo. But do not know where to search or post it
> :)
> >>
> >> My script looks like:
> >>
> >> url="http://mypage"
> >> curl_opts="-x ''"
> >> curl $url -d \"mydata\" $curl_opts
> >>
> >> If I execute it, I got an error from curl, saying it cannot resolve
> >> the proxy ''.
> >>
> >> But If I modify the script to:
> >>
> >> url="http://mypage"
> >> curl $url -d \"mydata\" -x ''
> >>
> >> It works fine.
> >>
> >> I guess there's something wrong with the argument expansion. Just do
> >> not know how to fix it. Please help.
> >>
> >>
> >> --
> >> Best Regards,
> >> Xi Shen (David)
> >>
> >> http://twitter.com/davidshen84/
> >>
> >>
> >
> >
> > --
> > --
> > Pandu E Poluan - IT Optimizer
> > My website: http://pandu.poluan.info/
> >
> >
>
>
>
> --
> Best Regards,
> Xi Shen (David)
>
> http://twitter.com/davidshen84/
>
> I have replied you before.
What I have sent you is the solution to your problems.
Try to run what I told you.
I ran it successfully on my comp.
curl_opts=-x ""
Kfir
[-- Attachment #2: Type: text/html, Size: 2863 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 9:25 ` Kfir Lavi
@ 2011-05-09 10:36 ` Alex Schuster
2011-05-09 12:06 ` Kfir Lavi
0 siblings, 1 reply; 17+ messages in thread
From: Alex Schuster @ 2011-05-09 10:36 UTC (permalink / raw
To: gentoo-user
Kfir Lavi writes:
> On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@googlemail.com>
> wrote:
> > On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@poluan.info> wrote:
> > > On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
> > >> My script looks like:
> > >>
> > >> url="http://mypage"
> > >> curl_opts="-x ''"
> > >> curl $url -d \"mydata\" $curl_opts
> > >>
> > >> If I execute it, I got an error from curl, saying it cannot resolve
> > >> the proxy ''.
> > >>
> > >> But If I modify the script to:
> > >>
> > >> url="http://mypage"
> > >> curl $url -d \"mydata\" -x ''
> > >>
> > >> It works fine.
> > >>
> > >> I guess there's something wrong with the argument expansion. Just do
> > >> not know how to fix it. Please help.
Do as you tried first, but add an eval:
eval curl "$url" -d \"mydata\" $curl_opts
> > I have replied you before.
>
> What I have sent you is the solution to your problems.
> Try to run what I told you.
> I ran it successfully on my comp.
> curl_opts=-x ""
This gives a "command not found" error, as bash tries to execute the empty
command "". Are you using another shell?
Wonko
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 10:36 ` Alex Schuster
@ 2011-05-09 12:06 ` Kfir Lavi
0 siblings, 0 replies; 17+ messages in thread
From: Kfir Lavi @ 2011-05-09 12:06 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
On Mon, May 9, 2011 at 1:36 PM, Alex Schuster <wonko@wonkology.org> wrote:
> Kfir Lavi writes:
>
> > On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@googlemail.com>
> > wrote:
>
> > > On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@poluan.info>
> wrote:
>
> > > > On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
>
> > > >> My script looks like:
> > > >>
> > > >> url="http://mypage"
> > > >> curl_opts="-x ''"
> > > >> curl $url -d \"mydata\" $curl_opts
> > > >>
> > > >> If I execute it, I got an error from curl, saying it cannot resolve
> > > >> the proxy ''.
> > > >>
> > > >> But If I modify the script to:
> > > >>
> > > >> url="http://mypage"
> > > >> curl $url -d \"mydata\" -x ''
> > > >>
> > > >> It works fine.
> > > >>
> > > >> I guess there's something wrong with the argument expansion. Just do
> > > >> not know how to fix it. Please help.
>
> Do as you tried first, but add an eval:
> eval curl "$url" -d \"mydata\" $curl_opts
>
> > > I have replied you before.
> >
> > What I have sent you is the solution to your problems.
> > Try to run what I told you.
> > I ran it successfully on my comp.
> > curl_opts=-x ""
>
> This gives a "command not found" error, as bash tries to execute the empty
> command "". Are you using another shell?
>
> Wonko
>
> Sorry,
I have put www.google.com in th url, so got the page, and didn't notice the
error. hehe
Kfir
[-- Attachment #2: Type: text/html, Size: 2605 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 5:44 [gentoo-user] [OT] bash script error Xi Shen
2011-05-09 6:43 ` Nils Andresen
2011-05-09 8:31 ` Pandu Poluan
@ 2011-05-09 12:57 ` BRM
2011-05-09 14:16 ` Kevin McCarthy
3 siblings, 0 replies; 17+ messages in thread
From: BRM @ 2011-05-09 12:57 UTC (permalink / raw
To: gentoo-user
Well, I saw a lot of advice on this but no real solution - just some debugging
help.
At least from my own experience with Bash Scripting, I find that you can never
use enough braces when referencing variables.
So, the script should read:
url="http://mypage"
curl_opts="-x"
curl ${url} -d \"mydata\" ${curl_opts}
I would probably even go one further and use quotes in the final line as well,
thus producing:
curl "${url}"-d \"mydata\" "${curl_opts}"
Please note that the single and double quotes have meanings as far as expansion.
Also, the guys on IRC (#bash) are quite helpful - a great resource in addition
to 'man bash'.
$0.02
Ben
----- Original Message ----
> From: Xi Shen <davidshen84@googlemail.com>
> To: gentoo-user <gentoo-user@lists.gentoo.org>
> Sent: Mon, May 9, 2011 1:44:58 AM
> Subject: [gentoo-user] [OT] bash script error
>
> It is not specific to Gentoo. But do not know where to search or post it :)
>
> My script looks like:
>
> url="http://mypage"
> curl_opts="-x ''"
> curl $url -d \"mydata\" $curl_opts
>
> If I execute it, I got an error from curl, saying it cannot resolve
> the proxy ''.
>
> But If I modify the script to:
>
> url="http://mypage"
> curl $url -d \"mydata\" -x ''
>
> It works fine.
>
> I guess there's something wrong with the argument expansion. Just do
> not know how to fix it. Please help.
>
>
> --
> Best Regards,
> Xi Shen (David)
>
> http://twitter.com/davidshen84/
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 5:44 [gentoo-user] [OT] bash script error Xi Shen
` (2 preceding siblings ...)
2011-05-09 12:57 ` BRM
@ 2011-05-09 14:16 ` Kevin McCarthy
2011-05-10 22:57 ` David Haller
3 siblings, 1 reply; 17+ messages in thread
From: Kevin McCarthy @ 2011-05-09 14:16 UTC (permalink / raw
To: gentoo-user
On Mon, May 09, 2011 at 01:44:58PM +0800, Xi Shen wrote:
> It is not specific to Gentoo. But do not know where to search or post it :)
>
> My script looks like:
>
> url="http://mypage"
> curl_opts="-x ''"
> curl $url -d \"mydata\" $curl_opts
>
> If I execute it, I got an error from curl, saying it cannot resolve
> the proxy ''.
>
While bash arrays probably aren't required for this, the following seems
to work OK:
curl_opts=(-x "")
curl $url -d \"mydata\" "${curl_opts[@]}"
But I'm sure there's a quotes-only solution, too.
--
Kevin McCarthy <signals@gentoo.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
2011-05-09 14:16 ` Kevin McCarthy
@ 2011-05-10 22:57 ` David Haller
0 siblings, 0 replies; 17+ messages in thread
From: David Haller @ 2011-05-10 22:57 UTC (permalink / raw
To: gentoo-user
Hello,
On Mon, 09 May 2011, Kevin McCarthy wrote:
>On Mon, May 09, 2011 at 01:44:58PM +0800, Xi Shen wrote:
>> It is not specific to Gentoo. But do not know where to search or post it :)
>>
>> My script looks like:
>>
>> url="http://mypage"
>> curl_opts="-x ''"
>> curl $url -d \"mydata\" $curl_opts
>>
>> If I execute it, I got an error from curl, saying it cannot resolve
>> the proxy ''.
>>
>
>While bash arrays probably aren't required for this, the following seems
>to work OK:
When using the bash anyway, arrays are the thing to use!
>curl_opts=(-x "")
>curl $url -d \"mydata\" "${curl_opts[@]}"
>
>But I'm sure there's a quotes-only solution, too.
I can't find one. Seems to be some curl weirdness layered on top. Even
with
strace -eexecve curl "$url" -d "mydata" $curl_opts
and (quoted, escaped etc.) variations thereof, I haven't found a
version that works.
If you want to just DL some stuff, with POST, no proxy, why not use
wget?
wget --post-data="mydata" --no-proxy "$url"
(and if you want the result on stdout, just add '-O -', i.e.:
wget --post-data="mydata" --no-proxy -O - "$url"
). Or if you want the options as such:
url=...
wget_opts="--no-proxy -O -" ### special chars need to be
### once-escaped when using
### options/arguments with spaces,
### quotes etc.
post_data="foo=bar"
set -x
wget ${wget_opts} --post-data="$post_data" "$url"
### ^^^^^^^^^^^^ no quotes here, or use an array!
HTH,
-dnh
--
Doesn't it bother you, that we have to search for intelligent life
--- OUT THERE??
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [gentoo-user] [OT] bash script error
@ 2011-05-09 10:45 JDM
2011-05-10 22:30 ` David Haller
0 siblings, 1 reply; 17+ messages in thread
From: JDM @ 2011-05-09 10:45 UTC (permalink / raw
To: gentoo-user
He
------Original Message------
From: Alex Schuster
To: gentoo-user@lists.gentoo.org
ReplyTo: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] bash script error
Sent: 9 May 2011 11:36
Kfir Lavi writes:
> On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@googlemail.com>
> wrote:
> > On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@poluan.info> wrote:
> > > On 2011-05-09, Xi Shen <davidshen84@googlemail.com> wrote:
> > >> My script looks like:
> > >>
> > >> url="http://mypage"
> > >> curl_opts="-x ''"
> > >> curl $url -d \"mydata\" $curl_opts
> > >>
> > >> If I execute it, I got an error from curl, saying it cannot resolve
> > >> the proxy ''.
> > >>
> > >> But If I modify the script to:
> > >>
> > >> url="http://mypage"
> > >> curl $url -d \"mydata\" -x ''
> > >>
> > >> It works fine.
> > >>
> > >> I guess there's something wrong with the argument expansion. Just do
> > >> not know how to fix it. Please help.
Do as you tried first, but add an eval:
eval curl "$url" -d \"mydata\" $curl_opts
> > I have replied you before.
>
> What I have sent you is the solution to your problems.
> Try to run what I told you.
> I ran it successfully on my comp.
> curl_opts=-x ""
This gives a "command not found" error, as bash tries to execute the empty
command "". Are you using another shell?
Wonko
Sent from my BlackBerry® wireless device
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-05-10 23:00 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-09 5:44 [gentoo-user] [OT] bash script error Xi Shen
2011-05-09 6:43 ` Nils Andresen
2011-05-09 7:48 ` Xi Shen
2011-05-09 7:52 ` Kfir Lavi
2011-05-09 8:14 ` Xi Shen
2011-05-09 8:23 ` Xi Shen
2011-05-09 8:30 ` Pandu Poluan
2011-05-09 8:31 ` Pandu Poluan
2011-05-09 9:00 ` Xi Shen
2011-05-09 9:25 ` Kfir Lavi
2011-05-09 10:36 ` Alex Schuster
2011-05-09 12:06 ` Kfir Lavi
2011-05-09 12:57 ` BRM
2011-05-09 14:16 ` Kevin McCarthy
2011-05-10 22:57 ` David Haller
-- strict thread matches above, loose matches on Subject: below --
2011-05-09 10:45 JDM
2011-05-10 22:30 ` David Haller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox