2014-02-28 123 views
-1

我試圖找到包含在輸出非字母數字字符的文件名:爲什麼我的腳本在我嘗試運行時掛起?

svn ls -R url 

我寫了下面的Perl腳本來做到這一點:

#!/usr/local/bin/perl -w 

while (<>) { 
    s|/$||; 
    s|^|code/|; 
    if (!m|.*(/[-./\w]+?$)|) { 
     print "$_"; 
    } 
} 

我運行下面的命令在我的外殼:

svn ls -R url 
./script 

但我的終端在./script命令後掛起。爲什麼?

+0

所以,你想找到svn的ls'在文件名中包含非字母數字字符用'返回的路徑? – ThisSuitIsBlackNot

+0

你爲什麼[刪除](http://stackoverflow.com/questions/22102770/i-create-a-script-that-find-a-space-and-specialcharacter-in-file-name-but-having)並重新提出你的問題?啊,你有一個[歷史](http://stackoverflow.com/questions/22076350/i-want-to-find-all-the-file-names-present-in-svn-which-contains-spaces - 規格)。請不要這樣做,這很粗魯。 –

+0

當然,我會確保無暇的時間。謝謝。 – user3347080

回答

4

您的腳本正在等待輸入stdin。管svn ls的結果,你的腳本是這樣的:

svn ls -R url | ./script 
相關問題