Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-27-2013, 05:05 AM   #1
LQ Newbie
Registered: Jan 2013
Posts: 4

Rep: Reputation: Disabled
Curl jugl


When I execute this command within a terminal it works fine. Bu when I execute it from within a shell script ( it fails to execute properly.

curl -i -k  -H "authorization-code: <HASH>" -H Content-Type:application/tst.server.commandParams+xml -X POST -d "@deploy-request"
Shell script (
EXEC=`curl -i -k -H "$authHeader" -H "Content-Type:application/tst.server.commandParams+xml" -X POST "$HREF""/action/rework" -d "@deploy-request"`
The latter one does not work when executed from within the shell script.
I think because the $authHeader contains a space and maybe also special characters.

Can someone please help me with only this problem?

Thank you in advance.
Old 01-27-2013, 05:07 AM   #2
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295

When you run that command from a shell script it runs it in a subshell. Do the variables you create in your script exist in that subshell (did you export them?)? I'd check with some echo commands for the values that the used variables have.

Kind regards,

Old 01-27-2013, 05:28 AM   #3
LQ Newbie
Registered: Jan 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
An echo shows:
-H Content-Type:application/tst.server.commandParams+xml -X POST...................
So I think the space in the $authHeader is causing problems.

How can I cope with the space in that variable?

Thank you in advance.


charachters, curl, special

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Curl certificates mlpa Slackware 2 04-10-2012 07:28 AM
curl bloodsugar Slackware 7 08-17-2009 10:09 AM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 11:42 AM
curl help furqan_sindhu Programming 5 09-13-2007 05:14 AM
cURL ballistic509 Debian 2 06-11-2006 01:06 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration