2016-04-26 146 views
0
"wget --user-agent=Mozilla/5.0 --save-cookies cookies.txt --post-data 'dir="$dir1"=&file="$file1"' --no-check-certificate http://test.com/mp3/file.php" 

工作正常,但在外殼腳本其示出沒有這樣的文件或目錄wget的POSTDATA在命令行一切沒有這樣的文件或目錄

wget的--user劑=的Mozilla/5.0 --save-餅乾cookie.txt的--post數據 'DIR = L011c2ljYW5fU2luZ2VyL1N1amF0aGEgSGl0cw === &文件= S2FhdHJ1IEthYXRydSAtIElzYWlBcnV2aS5OZXQubXAz' --no檢查證書http://test.com/mp3/file.php:沒有這樣的文件或目錄

+0

'wget的--user劑=的Mozilla/5.0 --save餅乾cookie.txt的--post數據「目錄= 「$ DIR1」=&文件=「$ file1的「'--no-check-certificate」http://test.com/mp3/file.php「' – jDo

+0

同樣的錯誤來了@jDo –

+1

這個錯誤看起來像是當你試圖運行它的時候, shell並沒有將它拆分並運行。 (嘗試使用shell中的引號來運行''wget word word word「')。那是怎麼回事? –

回答

0

我不知道wget之前的雙引號是格式錯誤("wget --user-a ...)還是實際上是命令的一部分;無論哪種方式,刪除它。另外,請嘗試雙引號的網址。這對我的作品在命令行和shell腳本:

wget --user-agent=Mozilla/5.0 --save-cookies cookies.txt --post-data 'dir="$dir1"=&file="$file1"' --no-check-certificate "http://test.com/mp3/file.php" 

運行腳本包含以下命令:

[email protected]:~$ sh wget_script.sh 
--2016-04-26 14:28:42-- http://test.com/mp3/file.php 
Resolving test.com (test.com)... 69.172.200.235 
Connecting to test.com (test.com)|69.172.200.235|:80... connected. 
HTTP request sent, awaiting response... 302 Moved Temporarily 
Location: https://www.test.com/ [following] 
--2016-04-26 14:28:42-- https://www.test.com/ 
Resolving www.test.com (www.test.com)... 69.172.200.235 
Connecting to www.test.com (www.test.com)|69.172.200.235|:443... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: unspecified [text/html] 
Saving to: ‘file.php’ 

    [ <=>                           ] 1,557  --.-K/s in 0s  

2016-04-26 14:28:42 (92.4 MB/s) - ‘file.php’ saved [1557] 

[email protected]:~$ 
+0

位置:http://test.com/mp3//load/v*%F5/~)^ [關注] 警告:HTTP中不支持通配符。 –

+0

DIR1 = L011c2ljYW5fU2luZ2VyL1N1amF0aGEgSGl0cw ==文件2 = S2FhdHJ1IEthYXRydSAtIElzYWlBcnV2aS5OZXQubXAz –

+0

我只是在使用兩個varaibles見上述評論 –

-1

也許增加了wget的路徑將有助於:

​​

會返回例如/usr/bin/wget。嘗試將該路徑添加到您的命令行。

+0

這不是問題。找到並運行'wget',但是OP要麼傳入一個無效的URL(通過嘗試使用globbing),要麼被重定向到一個無效的URL – jDo

+0

@jDo也許你是對的,但OP將決定什麼是有用的。在任何情況下,使用命令的完整路徑在shell腳本中都是很好的做法。 –

+0

我試過'/ usr/bin/wget'同樣的問題.. –

0

也定義你的腳本里面的變量。 (DIR1 =和文件=)

#!/bin/bash 

dir1="bla" 
file="blabl.bla" 

wget --user-agent=Mozilla/5.0 --save-cookies cookies.txt --post-data 'dir="$dir1"=&file="$file1"' --no-check-certificate http://test.com/mp3/file.php 
相關問題