...

/

Exercise: The [[ Operator and Directories

Exercise: The [[ Operator and Directories

Put into practice what we’ve learned about the [[ operator.

We'll cover the following...

Exercise

Write a script to compare two directories named dir1 and dir2. The script should print all files from one directory that are absent in the other one.

# Write the code here.
Operator [[ exercise

Solution

Let’s compare the contents of the two directories. The result of the comparison is a list of files that differ.

First, we have to go through all the files in each directory. The find utility does this task. Here is a command ...