I know you can use the find command for this simple job, but I got an assignment not to use find or ls and do the job. How can I do th
Since it is for bash, it is a surprise that this hasn't been already said:
(globstar valid from bash 4.0+)
shopt -s globstar nullglob dotglob
echo **/*/
That's all.
The trailing slash / is there to select only dirs.
Option globstar activates the ** (search recursivelly).
Option nullglob removes an * when it matches no file/dir.
Option dotglob includes files that start wit a dot (hidden files).