how to execute curl in bash script within a function.

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 executes fine.

pls help

function callCurl(){

  url=$1 #Receive 'http://hostname:8080/job/job1/buildWithParameters?arg1=true&arg2=Full'

  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'

* Unsupported protocol: 'http
curl: (1) Unsupported protocol: 'http
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.


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
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
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Please select my post as the correct answer, as stated in your comment
South ModModeratorCommented:

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.

EE Moderator
enthuguyAuthor Commented:
hi brendanmeyer, apologies.
not sure what went wrong.

Yes, you solution worked. Thx again.
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.