[ACCEPTED]-Diff without files-diff
Accepted answer
You can diff standard input with a file 4 by using the special filename -
:
# diff the contents of the file 'some-file' with the string "foobar"
echo foobar | diff - some-file
With bash, you 3 can also use anonymous named pipes (a bit 2 of a misnomer) to diff two pipelines:
# diff the string "foo" with the string "baz"
diff <(echo foo) <(echo baz)
See 1 also How can you diff two pipelines with bash?.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.