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=$sleepinterval

  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
=============================
enthuguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

brendanmeyerCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enthuguyAuthor Commented:
hi brendanmeyer, that worked ...thanks a lot. :)

hats off to EE
0
enthuguyAuthor Commented:
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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

brendanmeyerCommented:
Please select my post as the correct answer, as stated in your comment
0
South ModModeratorCommented:
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
0
enthuguyAuthor Commented:
hi brendanmeyer, apologies.
not sure what went wrong.

Yes, you solution worked. Thx again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.