公告
财富商城
积分规则
提问
发文
2020-06-08 23:34发布
地球回转人心会变
Is it possible to use the "diff" tool without having physical files? Something like this:
diff "hello" "hell"
You can diff standard input with a file 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 can also use anonymous named pipes (a bit of a misnomer) to diff two pipelines:
# diff the string "foo" with the string "baz" diff <(echo foo) <(echo baz)
See also How can you diff two pipelines with bash?.
最多设置5个标签!
You can diff standard input with a file by using the special filename
-
:With bash, you can also use anonymous named pipes (a bit of a misnomer) to diff two pipelines:
See also How can you diff two pipelines with bash?.