Solved

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

Posted on 2013-11-25
1
943 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 500 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

691 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