2009-06-13 7 views
9

物理ファイルを持たずに「差分」ツールを使用できますか?このような何か:あなたは特別なファイル名-使用して、ファイルを標準入力をdiffをすることができますファイルがない差分

diff "hello" "hell" 

答えて

16

ます。bashで

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

を、あなたはまた、匿名の名前付きパイプ(誤った名称のビット)を使用することができます

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

また、How can you diff two pipelines with bash?も参照してください。

+0

++私にそれを打つ。 – guns

関連する問題