I have one file that contains a list of files from a server, and a local folder that I compare to that manifest. Obviously, I do 'ls -1 > listing_local' and then diff that file with listing_server.

But is it possible to diff the manifest and the output of ls immediately to the diff command?

link|improve this question

0% accept rate
feedback

migrated from stackoverflow.com Jan 27 '10 at 13:56

This question came from our site for professional and enthusiast programmers.

4 Answers

In bash:

diff listing_server <(ls -1)
link|improve this answer
feedback

You can pipe the output of a unix command into the input of another.

ls -1 | diff file_goes_here -
link|improve this answer
this won't work – John T Jan 27 '10 at 15:18
Now it does. That's what I get for not testing it first. – Josh K Jan 27 '10 at 16:01
feedback
diff listing <(ls -1)
link|improve this answer
feedback
ls -1 | diff listing_server -
link|improve this answer
The -1 is unnecessary if the output is not to a terminal. – Peter Eisentraut Jan 27 '10 at 16:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.