Write a script that compares two directories and lists files present in one but not the other.
IntermediateHands-onBash scripting tasks
Answer
diff <(cd dirA && find . -type f | sort) <(cd dirB && find . -type f | sort)
# or only names unique to dirA:
comm -23 <(cd dirA && find . -type f | sort) <(cd dirB && find . -type f | sort)
Key trick → Process substitution <(...) turns command output into a file path, and comm needs both inputs sorted.
More on Bash scripting tasks
Write the safe header you start every Bash script with, and explain each part.BeginnerWrite a script that alerts when any filesystem is above 80% usage.BeginnerParse an Nginx access log and print the top 10 client IPs by request count.BeginnerWrite a backup script that tars a directory with a timestamp and keeps only the last 7 backups.IntermediateWrite a health-check loop that polls a URL until it returns 200, with a timeout.IntermediateParse command-line flags `-e <env>`, `-v` (verbose) and `-h` in a Bash script.Intermediate