Question: In this assignment you will write a recursive function in bash that will do a preorder traversal of a given directory and list the contents

In this assignment you will write a recursive function in bash that will do a preorder traversal of a given directory and list the contents of the directory and all the sub-directories under it. The behavior of your script should be similar to that of 'ls -R arg1' where arg1 is the directory that needs to be traversed and listed.
NOTE: You are not allowed to use 'ls' or any other command that displays the contents of a directory. You can use echo, pwd, and cd.
There are empty directories and symbolic links, these should not be printed when using echo. These need to be set to dev/null or ignored in some other way.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!