PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   七嘴八舌異言堂 (https://www.pcdvd.com.tw/forumdisplay.php?f=12)
-   -   請問一下我想寫一個 shell script 能包含 -r (Recursive)這個參數 (https://www.pcdvd.com.tw/showthread.php?t=394456)

result12 2004-10-06 11:50 PM

請問一下我想寫一個 shell script 能包含 -r (Recursive)這個參數
 
請教一下大家, 我想寫一個 shell script , 執行這個 script 時, 能夠加入 -r 這個參數, recursively 搜尋目前目錄底下, 的所有子目錄裡的檔案, 並對所有子目錄裡的檔案執行這個 script.
請問大家知道, 有沒有適合的指令, 可以用在我的 shell script 裡呢? 請問有沒有方便的指令可利用呢? 又或 -r (recursive) 這個指令的大概寫法是怎樣? 麻煩大家了

kasl 2004-10-07 12:04 AM

去查一下 perl 的語法
這不難 動手翻一下書吧

leonlin 2004-10-07 12:25 AM

引用:
作者kasl
去查一下 perl 的語法
這不難 動手翻一下書吧


用 man 去看一下 find 這個 command 應該就能用了!

result12 2004-10-07 01:24 AM

我想到的是, ls , 然後把 ls 的值傳給 array string, 再一個string一個string 的去判斷是不是檔案或是子目錄, 是檔案就執行我的script, 是目錄就 cd <string>, 如此recursive下去,直到最後一個目錄,最後一個檔案,這樣會很笨嗎?

result12 2004-10-07 01:28 AM

引用:
作者kasl
去查一下 perl 的語法
這不難 動手翻一下書吧

我還沒學到 perl, 不過我會去看看, 謝謝 :)

result12 2004-10-07 01:31 AM

引用:
作者leonlin
用 man 去看一下 find 這個 command 應該就能用了!

啊 對喔...., 這樣我就不用真的一個一個目錄下去找, 謝謝啦 :)


所有的時間均為GMT +8。 現在的時間是07:35 PM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。