2012-11-15 33 views
1

可能重複:
wget: Unsupported scheme on non-http URL如何通過bash中的FILE URI方案下載文件?

例如:

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

如何從這個URI下載SYSTEM.LOG文件在bash?

我嘗試過使用wgetcurl,但他們不支持FILE URI方案。

+0

確定嗎? man curl說FILE是一個支持的協議 –

+0

你可以用正則表達式去除前導的「file://」 –

+1

問兩次同樣的問題不會讓你試圖做的事情成爲可能。 –

回答

3

試着這樣做:

export URI="file:///etc/passwd" 
curl -s "$URI" > /tmp/l 
cat /tmp/l 

如果您需要下載遠程文件,你需要使用其他協議(和方案),如:

curl ftp://user:[email protected]:port/path/to/file 

scp host:/path/to/file file 

等...

注意

curl能夠下載文件方案,儘管你說的話。