Given two directories:
$ ls ~/dir-new/ file-01.txt file-02.txt file-new.txt
$ ls ~/dir/ file-01.txt file-02.txt file-old.txt
To compare them:
comm <(ls ~/dir-new/) <(ls ~/dir)
comm compares two files line-by-line and displays 3 columns : 1) lines unique to first file, 2) lines unique to second file, 3) lines appear in both files.
file-01.txt file-02.txt file-new.txt file-old.txt
To remove Column 1, try
'comm -1', and
'comm -23' will remove Column 2 and 3.
'<(ls ~/dir-new/)', they call it as process substitution. Since
comm only reads from files,
'<( )' pretends itself as a file by returning a filename, which is read-only, containing the output of
In short, we may think
'<(commands)' as a pseudo, read-only file:
$ ls -l <(true) lr-x------ 1 toydi toydi 64 2006-11-08 14:30 /dev/fd/63 -> pipe: