4 ms·
Just diff the two directories. $ ls a b a: 1 2 3 4 b: 1 2 3 # Yours: $ diff -u <(cd a && find . | sort) <(cd b && fi
by sixtofour 15y ago
Just diff the two directories.
$ ls a b
a:
1 2 3 4
b:
1 2 3
# Yours:
$ diff -u <(cd a && find . | sort) <(cd b && find . | sort)
--- /dev/fd/63 2011-11-20 02:50:21.919072726 -0700
+++ /dev/fd/62 2011-11-20 02:50:21.919072726 -0700
@@ -2,4 +2,3 @@
./1
./2
./3
-./4
# Mine:
$ diff -u a b
diff -u a/1 b/1
--- a/1 2011-11-20 02:43:57.073130007 -0700
+++ b/1 2011-11-20 02:45:14.535912768 -0700
@@ -1 +1 @@
-1
+11
Only in a: 4
Maybe I'm missing something?
- jav 15y agoThe OP's example is diffing listings of the two directories whereas your command is asking diff to directly work on the directories themselves.
- robertskmiles 15y agoWhich means for example you could get that listing in any format, so you could for example spot changes in permissions or ownership if you included it in the listing.
- sixtofour 15y agoI stand enlightened.
- super_mario 15y agoYes, you are because the example was contrived. The point is that process substitution (as it is called) is available on systems that support named pipes. You could think of better uses for it.