2017-04-01 47 views
0

我正試圖找到最好的方式從perl目錄中的所有文件中刪除雙引號。我知道我可以通過「rename \」「」*'來做到這一點,但是當我在perl腳本中有這樣的情況時,perl總是抱怨雙引號不關閉。在我的Perl腳本rename \" "" *內反向調用它,但這給了我bash錯誤:'意想不到的EOF,同時尋找匹配`''Perl - 從目錄中的文件名中刪除雙引號

我有這種情況。我在這個名字爲123的目錄中有文件。「ABC」.xyz。我想用命令重命名perl腳本。

感謝,

+0

很難確定代碼中的錯誤是什麼它! – ikegami

回答

2

How can I work around it?

沒有解決辦法需要;你只需修復你的bug。要刪除一個字符串中刪除雙引號("),你可以使用以下命令:

$string =~ s/"//g; 

I've tried to call it with backtick inside my perl script rename \" "" *

你做

`rename \" "" *` # Produces the string <<rename " "" *>> and executes it. 

時,你應該使用

`rename \\" "" *` # Produces the string <<rename \" "" *>> and executes it.