Gentoo Archives: gentoo-user

From: JDM <jdm@×××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] bash script error
Date: Mon, 09 May 2011 10:47:23
Message-Id: 1019987605-1304937945-cardhu_decombobulator_blackberry.rim.net-1008182267-@b14.c20.bise7.blackberry
1 He
2
3 ------Original Message------
4 From: Alex Schuster
5 To: gentoo-user@l.g.o
6 ReplyTo: gentoo-user@l.g.o
7 Subject: Re: [gentoo-user] [OT] bash script error
8 Sent: 9 May 2011 11:36
9
10 Kfir Lavi writes:
11
12 > On Mon, May 9, 2011 at 12:00 PM, Xi Shen <davidshen84@××××××××××.com>
13 > wrote:
14
15 > > On Mon, May 9, 2011 at 4:31 PM, Pandu Poluan <pandu@××××××.info> wrote:
16
17 > > > On 2011-05-09, Xi Shen <davidshen84@××××××××××.com> wrote:
18
19 > > >> My script looks like:
20 > > >>
21 > > >> url="http://mypage"
22 > > >> curl_opts="-x ''"
23 > > >> curl $url -d \"mydata\" $curl_opts
24 > > >>
25 > > >> If I execute it, I got an error from curl, saying it cannot resolve
26 > > >> the proxy ''.
27 > > >>
28 > > >> But If I modify the script to:
29 > > >>
30 > > >> url="http://mypage"
31 > > >> curl $url -d \"mydata\" -x ''
32 > > >>
33 > > >> It works fine.
34 > > >>
35 > > >> I guess there's something wrong with the argument expansion. Just do
36 > > >> not know how to fix it. Please help.
37
38 Do as you tried first, but add an eval:
39 eval curl "$url" -d \"mydata\" $curl_opts
40
41 > > I have replied you before.
42 >
43 > What I have sent you is the solution to your problems.
44 > Try to run what I told you.
45 > I ran it successfully on my comp.
46 > curl_opts=-x ""
47
48 This gives a "command not found" error, as bash tries to execute the empty
49 command "". Are you using another shell?
50
51 Wonko
52
53
54
55 Sent from my BlackBerry® wireless device

Replies

Subject Author
Re: [gentoo-user] [OT] bash script error David Haller <gentoo@×××××××.de>