linux - Getting directory list with serial number in shell script -


i wanna list out sub directory in main directory serial numbers.

example :

if directory contains b,c,d , e sub directory output should like

1 b 2 c 3 d 4 e 

you use loop:

i=0 f in a/*/;     echo "$((++i)) $f" done 

the pattern matches directories in a. $((++i)) increments variable $i 1 each directory found.


Comments