[SLL] Simple Bash execution of string: How do I execute the string?

Xeno Campanoli xcampanoli at gmail.com
Tue Jun 10 15:37:04 PDT 2008


I've got a simple call:

curl -L -i -H 'Content-Type: text/html; charset=utf-8' host

which works great, but when I go:

x="curl -L -i -H 'Content-Type: text/html; charset=utf-8' host"

(and I can check it, and it looks the same as the one that works when I 
go echo $x) then doing:

`$x` is not working for me.  It is getting the parts of the header 
string as separate arguments:

curl: (6) Couldn't resolve host 'text'

curl: (6) Couldn't resolve host 'charset=utf-8''

This is a little nutty, but I've been shell programming for years, and 
I'm not seeing what's wrong here.  Perhaps curl is doing something 
special, but I don't think so.  I guess I've just not done this before. 
  Anybody have a clue?

Thanks in advance.


More information about the linux-list mailing list