How to recursively list subdirectories in Bash without using “find” or “ls” commands?

前端 未结 10 2132
情歌与酒
情歌与酒 2020-12-01 17:22

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

10条回答
  •  日久生厌
    2020-12-01 17:46

    Like Mark Byers said you can use echo * to get a list of all files in the current directory.

    The test or [] command/builtin has an option to test if a file is a directory.

    Apply recursion and you're done.

提交回复
热议问题