Solved

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

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

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…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

828 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