LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

Rep: Reputation: Disabled
Curl jugl


Hello,

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

terminal
Code:
curl -i -k  -H "authorization-code: <HASH>" -H Content-Type:application/tst.server.commandParams+xml -X POST https://xxx.xxx.xxx/api/test/test-sadasd-asdewfdsf-dsfsdfsdf-dsf/action/rework -d "@deploy-request"
Shell script (test.sh)
Code:
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
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

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,

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

Original Poster
Rep: Reputation: Disabled
An echo shows:
Code:
-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.
 
  


Reply

Tags
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


All times are GMT -5. The time now is 07:27 PM.

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