gpt4 book ai didi

diff - 没有文件的差异

转载 作者:行者123 更新时间:2023-12-03 20:19:48 25 4
gpt4 key购买 nike

是否可以在没有物理文件的情况下使用“ diff”工具?像这样:

diff "hello" "hell"

最佳答案

您可以使用特殊文件名-将标准输入与文件进行比较:

# diff the contents of the file 'some-file' with the string "foobar"
echo foobar | diff - some-file


使用bash,您还可以使用匿名命名管道(有点用词不当)来区分两个管道:

# diff the string "foo" with the string "baz"
diff <(echo foo) <(echo baz)


另请参见 How can you diff two pipelines with bash?

关于diff - 没有文件的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/991722/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com