Write a shell script takes the name a path (eg: /afs/andrew/course/15/123/handin), and counts all the sub directories (recursively).
Ex. /afs/andrew/course/15/123/handin should give me 6. I tried with the Find command,but the path which i am giving is being accepted.
simple AWK can do that
root@freebsd:~ # echo /afs/andrew/course/15/123/handin | awk -F / '{ print NF-1}'
6
root@freebsd:~ #
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.