2009-06-13 7 views
9

실제 파일이 없어도 "diff"도구를 사용할 수 있습니까? 이런 식으로 뭔가 : 당신은 특별한 이름 - 사용하여 파일을 표준 입력을 diff를 할 수파일이없는 차이점

diff "hello" "hell" 

답변

16

: 배쉬와

# 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? 참조 : 두 개의 파이프 라인은 diff합니다.

+0

++ 나를 이길. – guns

관련 문제