Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ipconfig not working on windows 10 bash shell; what other commands are missing. 17 164
AWS - HAProxy- KeepAlived 5 41
AD LDAP LDS 3 65
VMware Workstation 12 Player 16 73
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

776 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