Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] [OT] bash script error Kfir Lavi <lavi.kfir@×××××.com>