用shell script下載檔案 - Linux

By Odelette
at 2016-04-22T17:51
at 2016-04-22T17:51
Table of Contents
系統:
Lubuntu 15.10 BASH
LANG=en_US.UTF-8
我想要寫個能夠自動下載特定檔案的script
於是參考這個網頁:
http://stackoverflow.com/questions/23463991/download-files-using-bash-script-using-wget
設定檔有兩個:
file.txt
termb_0.htm
termb_A.htm
termb_B.htm
termb_C.htm
termb_D.htm
=====================================
url.txt
url = http://www.iicm.org.tw/term/
=====================================
download.sh : 執行下載
#!/bin/sh
url=$(awk -F = '{print $2}' url.txt)
for i in $(cat file.txt);
do
wget "${url}${i}"
done
可是怎麼樣都失敗, url.txt的內容沒有被load到
錯誤訊息是類似:wget: unable to resolve host address ‘1.jpg’
可以請教該怎麼改善嗎?感謝
--
Lubuntu 15.10 BASH
LANG=en_US.UTF-8
我想要寫個能夠自動下載特定檔案的script
於是參考這個網頁:
http://stackoverflow.com/questions/23463991/download-files-using-bash-script-using-wget
設定檔有兩個:
file.txt
termb_0.htm
termb_A.htm
termb_B.htm
termb_C.htm
termb_D.htm
=====================================
url.txt
url = http://www.iicm.org.tw/term/
=====================================
download.sh : 執行下載
#!/bin/sh
url=$(awk -F = '{print $2}' url.txt)
for i in $(cat file.txt);
do
wget "${url}${i}"
done
可是怎麼樣都失敗, url.txt的內容沒有被load到
錯誤訊息是類似:wget: unable to resolve host address ‘1.jpg’
可以請教該怎麼改善嗎?感謝
--
Tags:
Linux
All Comments

By Edward Lewis
at 2016-04-23T10:54
at 2016-04-23T10:54

By Delia
at 2016-04-26T10:48
at 2016-04-26T10:48

By Madame
at 2016-05-01T06:32
at 2016-05-01T06:32

By Hedwig
at 2016-05-03T21:28
at 2016-05-03T21:28

By Hedy
at 2016-05-04T15:03
at 2016-05-04T15:03

By Ivy
at 2016-05-05T14:27
at 2016-05-05T14:27

By Kelly
at 2016-05-06T18:56
at 2016-05-06T18:56

By Olga
at 2016-05-09T05:35
at 2016-05-09T05:35

By Irma
at 2016-05-13T18:23
at 2016-05-13T18:23
Related Posts
Ubuntu 16.04 的 Unity8 根本無法登入阿

By Puput
at 2016-04-21T22:43
at 2016-04-21T22:43
在已有Linux / windows 的硬碟上重裝win

By Zenobia
at 2016-04-21T22:01
at 2016-04-21T22:01
MySQL該裝在哪裡比較適合?

By Joseph
at 2016-04-21T12:50
at 2016-04-21T12:50
shell script 迭帶命名變數

By Joe
at 2016-04-21T01:02
at 2016-04-21T01:02
檔案權限

By Quintina
at 2016-04-20T20:34
at 2016-04-20T20:34