curl可从命令行运行,但不能在shell脚本中运行(curl:(6)无法解析主机:)

时间:2018-06-20 20:05:42

标签: curl sh ubuntu-14.04

我正在Ubuntu 14.04中工作,并且进行了curl调用...

curl 'http://www.webglobes.org/cesarefortelegram/Telegram/OpenProntoSoccorsi/API/getProntoSoccorsoDetailsByMunicipality.php?municipality=Torino&distance=0'

...在命令行中可以正常工作,但是如果我在shell脚本中使用

  #!/bin/bash
  set -x
  .....
  .....
  /usr/bin/curl  'http://www.webglobes.org/cesarefortelegram/Telegram/OpenProntoSoccorsi/API/getProntoSoccorsoDetailsByMunicipality.php?municipality=Torino&distance=0'
  .....
  .....

我收到此错误

curl: (6) Could not resolve host: www.webglobles.org

我该如何解决?有建议吗?

1 个答案:

答案 0 :(得分:0)

它在My ubuntu 14.04版本中从命令行和Shell脚本都可以正常工作。与DNS有关的内容,请参阅下面的

curl: (6) Could not resolve host: google.com; Name or service not known

相关问题