wget: Unsupported scheme on non-http URL

2019-03-02 09:59发布

问题:

I have the following line in my shell script:

export URL=file://myhost/system.log
wget -v $URL

When I tried to run the script it give me the following error:

file://myhost/system.log: Unsupported scheme.

Does it mean wget supports http and ftp ONLY?

回答1:

man wget shows:

It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Try curl, it supports file URLs. Also note you probably want three slashes here. Two belong to the protocol indicator (file://) and one belongs to the path (/myhost/system.log)

export URL=file:///myhost/system.log


回答2:

wget for windows doesn't support https

unsupported scheme

tested : GNU Wget 1.9.1, a non-interactive network retriever



回答3:

There's 2 mistakes :

  • wget doesn't support file:// scheme
  • with Linux, the variables are called like "$URL", not %URL% like windows


标签: linux shell wget