Wednesday, 15 August 2012

linux - expanding shell variable in curl POST? -


I use the following line to create the database:

  curl -x post 'Http: //10.1.1.1:8086/db?u=root&p=root' -d '{name: test1}  

If I try to open it with the script I:

  ip = 10.1.1.1 curl -x post 'http: // $ ip: 8086 / db? U = root & amp; P = root '-d' {name: test1} ' <

  curl -x post "http: // $ ip: / pre> 

I have a quota Within is a problem with shell variable replacement, 8086 / dB? U = root and p = root "-d '{name: test1}'

variable is expanded at the right value , Print in the terminal

  curl -x post "http://10.1.21.1:8086/db?u=root&p=root" -d '{name: test1}': * * Any such file or directory **  

What will be the correct solution to this problem?

Try it out:

  ip = 10.1.1.1 curl -X Post 'http: //' "$ ip '': 8086 / db? U = root & amp; p = root '-d' {name: test1} ' 

No comments:

Post a Comment