How to: compare command output to text file with bash

bash, diff, linux, ls

Solution

The answer (for posterity) is to do the following

diff file.ls <(ls -l directory)

When I did this previously, the output was blank. I thought I had done it wrong; in actuality there was no difference between the contents of the directory and my file.

<\facepalm>

Problem

I'm trying to compare the output of the command ``` `ls -l directory` ``` with a file that I've created using the same command. (I'm trying a poor man's way of making sure no files have been modified.) The trouble is, I don't know how to `diff` the output of the `ls` command with the file that I've created. I've tried the following and each time it doesn't work ``` diff file.ls <(ls -l directory) ls -l directory | xargs diff file.ls ls -l directory | diff file.ls diff file.ls < `ls -l directory` ``` What is the magic command to compare the output of `ls` to a file that I've already saved?

Original source