enthuguy
asked on
how to execute curl in bash script within a function.
Hi,
I'm trying to execute curl in bash script within a function.
If I pass in endpoint as an argument to the function and use it within the function it fails with "curl: (1) Unsupported protocol: 'http"
However, if I execute with hardcoded value...it executes fine.
pls help
script
========================== ===
function callCurl(){
url=$1 #Receive 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full'
sleepInterval=$sleepinterv al
curl -v --user user:xxx ${url} # This one fails with below error
sleep 10
curl -v --user user:xxx 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full' # This works fine.
}
callCurl 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full'
Error:
* Unsupported protocol: 'http
curl: (1) Unsupported protocol: 'http
========================== ===
I'm trying to execute curl in bash script within a function.
If I pass in endpoint as an argument to the function and use it within the function it fails with "curl: (1) Unsupported protocol: 'http"
However, if I execute with hardcoded value...it executes fine.
pls help
script
==========================
function callCurl(){
url=$1 #Receive 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full'
sleepInterval=$sleepinterv
curl -v --user user:xxx ${url} # This one fails with below error
sleep 10
curl -v --user user:xxx 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full' # This works fine.
}
callCurl 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full'
Error:
* Unsupported protocol: 'http
curl: (1) Unsupported protocol: 'http
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for enthuguy's comment #a41173746
for the following reason:
Thanks for your quick help. That really helped
Accepted answer: 0 points for enthuguy's comment #a41173746
for the following reason:
Thanks for your quick help. That really helped
Please select my post as the correct answer, as stated in your comment
enthuguy,
Unfortunately it seems our attempts to attract new Expert attention have failed, so we'll close out this ticket now.
In cases like this it's often best to Delete your question and re-post it. Doing this puts it at the top of the question lists, and in front of the entire EE community, which generally means you'll get a better response.
Remember you can select 3 Topic Areas when posting, and it's always a good idea to do so. Take note of any changes the Moderators may have made to your Topic Areas and consider those when re-posting. Also, if any Experts posted and asked for more information, be sure to include that in your new post.
SouthMod
EE Moderator
Unfortunately it seems our attempts to attract new Expert attention have failed, so we'll close out this ticket now.
In cases like this it's often best to Delete your question and re-post it. Doing this puts it at the top of the question lists, and in front of the entire EE community, which generally means you'll get a better response.
Remember you can select 3 Topic Areas when posting, and it's always a good idea to do so. Take note of any changes the Moderators may have made to your Topic Areas and consider those when re-posting. Also, if any Experts posted and asked for more information, be sure to include that in your new post.
SouthMod
EE Moderator
ASKER
hi brendanmeyer, apologies.
not sure what went wrong.
Yes, you solution worked. Thx again.
not sure what went wrong.
Yes, you solution worked. Thx again.
ASKER
hats off to EE