How to subtract a set from another in Bash?
This is similar to: Is there a "set" data structure in bash? but different as it asks how to perform the subtra
uniq -u (manpage) is often the simplest tool for list subtraction:
Usage
uniq [OPTION]... [INPUT [OUTPUT]] [...] -u, --unique only print unique lines
Example: list files found in directory a but not in b
$ ls a file1 file2 file3 $ ls b file1 file3 $ echo "$(ls a ; ls b)" | sort | uniq -u file2