2016-08-17 82 views
0

將網頁發佈到wordpress我使用casperjs按以下方式讀取文件中的兩個參數:新網頁和密碼。將文件內容作爲命令行參數傳遞到Makefile中

casperjs tools/wordpresspublish.js 1 "$(< html/數1.html)" $(< tools/wppwd) 

從命令行可以正常工作。現在我試圖在Makefile中做同樣的事情:

.1.publ: 數1.html 
    casperjs tools/wordpresspublish.js 1 "$(cat html/數1.html)" $(cat tools/wppwd) 
    touch .1.publ 

它似乎以不同的方式解釋$。

我該怎麼寫呢?

回答

0

你必須寫兩遍,這樣逃避$字符:

casperjs tools/wordpresspublish.js 1 "$$(< html/數1.html)" $$(< tools/wppwd) 

也要注意這裏是來轉義另一個角色:#。爲了逃避它,輸入\#

+0

轉義似乎工作,但它不加載文件。當我在makefile中調用該命令時,這兩個文件似乎都是空的。我嘗試了絕對路徑(/ home/name/Development/2064/html /數字1.html),結果相同。 – Michael

+0

我發現:我必須在$()中寫「cat」而不是「<」然後它就起作用了。我在這個問題上改變了它。 – Michael

相關問題