?
Solved

Linux Shell Scripting:  Place string in curl command inside single quote

Posted on 2013-11-25
1
Medium Priority
?
946 Views
Last Modified: 2013-11-25
This works:
curl -k -u "uiimvuxd@sharklasers.com:password123" -X PUT https://zuhqtr5.couchappy.com/testupdates/_design/time2id/_update/u/ -d '{"hello": "world", "number": 555}' -H "Content-Type: application/json"

Open in new window

But this does NOT work:
zzz='{"hello": "world", "number": 555}'
curl -k -u "uiimvuxd@sharklasers.com:password123" -X PUT https://zuhqtr5.couchappy.com/testupdates/_design/time2id/_update/u/ -d '$zzz' -H "Content-Type: application/json"

Open in new window

How can I get it to preserve the single quotes and still put a string inside the single quotes?
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 39676494
zzz='{"hello": "world", "number": 555}'
curl -k -u "uiimvuxd@sharklasers.com:password123" -X PUT https://zuhqtr5.couchappy.com/testupdates/_design/time2id/_update/u/ -d "$zzz" -H "Content-Type: application/json"
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question