Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a Linux Bash script, create.sh which creates a directory tree in breadt

ID: 3536629 • Letter: 1

Question

1. Write a Linux Bash script, create.sh which creates a directory tree in breadth-first with depth d and breadth b. Depth refers to the level of the directory tree while breadth refers to the number of directories a directory may have, which will be discussed this Thursday. Use d and b between 3 and 5 inclusive for testing purposes. Your script must be able to handle any depth and breadth. Your command "create.sh 3 4 /home/cs288/hw1/tree" will create a tree with depth 3 and breath 4 at /home/cs288/hw1/tree in breadth-first.

Caution: Do not actually create a dir tree to begin with. First, simulate the tree structure until you can successfully create one. No need to put strain on your already hard-working hard disk for repeated reading/writing.

2. Write a Bash script, traverse.sh, to recursively traverse the dir tree in depth-first. Follow the format to be discussed this Thursday. Do not follow the example in the tutorial. For example, your command "traverse.sh /home/cs288/hw1/tree" will print everthing under the directory with complete path in depth-first, not breadth-first.

Explanation / Answer

ANSWER

FOLLOW THIS