簡體   English   中英

Shell腳本子目錄計算

[英]Shell scripting-subdirectories calculation

編寫一個shell腳本時,將名稱命名為路徑(例如:/ afs / andrew / course / 15/123 / handin),並計算所有子目錄(遞歸)。

例如 / afs / andrew / course / 15/123 / handin應該給我6.我嘗試了Find命令,但是我給的路徑被接受了。

簡單的AWK可以做到

root@freebsd:~ # echo /afs/andrew/course/15/123/handin | awk -F / '{ print NF-1}'
6
root@freebsd:~ #

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM