Gentoo Archives: gentoo-user

From: Kfir Lavi <lavi.kfir@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] bash script error
Date: Mon, 09 May 2011 12:08:42
Message-Id: BANLkTikjp_3iuZ6ot4u_o0nwF9VxcYGG_g@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] bash script error by Alex Schuster
1 On Mon, May 9, 2011 at 1:36 PM, Alex Schuster <wonko@×××××××××.org> wrote:
2
3 > Kfir Lavi writes:
4 >
5 > > On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@××××××××××.com>
6 > > wrote:
7 >
8 > > > On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@××××××.info>
9 > wrote:
10 >
11 > > > > On 2011-05-09, Xi Shen <davidshen84@××××××××××.com> wrote:
12 >
13 > > > >> My script looks like:
14 > > > >>
15 > > > >> url="http://mypage"
16 > > > >> curl_opts="-x ''"
17 > > > >> curl $url -d \"mydata\" $curl_opts
18 > > > >>
19 > > > >> If I execute it, I got an error from curl, saying it cannot resolve
20 > > > >> the proxy ''.
21 > > > >>
22 > > > >> But If I modify the script to:
23 > > > >>
24 > > > >> url="http://mypage"
25 > > > >> curl $url -d \"mydata\" -x ''
26 > > > >>
27 > > > >> It works fine.
28 > > > >>
29 > > > >> I guess there's something wrong with the argument expansion. Just do
30 > > > >> not know how to fix it. Please help.
31 >
32 > Do as you tried first, but add an eval:
33 > eval curl "$url" -d \"mydata\" $curl_opts
34 >
35 > > > I have replied you before.
36 > >
37 > > What I have sent you is the solution to your problems.
38 > > Try to run what I told you.
39 > > I ran it successfully on my comp.
40 > > curl_opts=-x ""
41 >
42 > This gives a "command not found" error, as bash tries to execute the empty
43 > command "". Are you using another shell?
44 >
45 > Wonko
46 >
47 > Sorry,
48 I have put www.google.com in th url, so got the page, and didn't notice the
49 error. hehe
50
51 Kfir