Curl pressing enter or ctr+c in order to have the right response

5,239

Some of the characters in your command are shell meta-characters. You are effectively starting one task in the background.

You need to quote your command. I've re-ordered the command since its a big ugly.

myip=$(curl "http://myip.dnsdynamic.org/")
curl --user <myusername>:<mypasswd> "https://www.dnsdynamic.org/api/?hostname=eventsonmap.ssh22.com&myip=${myip}"`
Share:
5,239

Related videos on Youtube

francescop
Author by

francescop

Updated on September 18, 2022

Comments

  • francescop
    francescop over 1 year

    This is a script that checks my current ip on this site: http://myip.dnsdynamic.org/ and pick the response and calls an API in order to update my dynamic ip.

    Here the script:

    curl --user <myusername>:<mypasswd> https://www.dnsdynamic.org/api/?hostname=eventsonmap.ssh22.com&myip=`curl http://myip.dnsdynamic.org/`
    

    When i run it it's all ok but the command stops and doesn't return normally it works only if at the end i press ENTER or ctrl+c what i'm doing wrong? I'm missing a param?

    This script is a cronjob that run every minyte so i can't press ENTER

    More info

    Here on pastebin the full result of the curl -v <same> here the last 2 lines:

    * Closing connection 0
    * SSLv3, TLS alert, Client hello (1):
    

    and blocks here...

  • francescop
    francescop about 10 years
    It works, totally appreciated. Thanks very much. So what's wrong? I'didn't catch the actual problem...are the ` ?
  • francescop
    francescop about 10 years
    ok sorry didn't read "you need to quote" thanks.
  • Dennis Williamson
    Dennis Williamson about 10 years
    @user3383667: You should also quote the username/password.