파일에 다음과 같은 명령이 있습니다.
diff file1 file2
diff file3 file4
그리고 출력되는 것이 있으면 다음과 같이 어떤 명령에서 이런 일이 발생했는지 인쇄하고 싶습니다.
diff file1 file2
if (there was output from the diff command)
print "file1 and file2 had the difference"
endif
diff file3 file4
if (there was output from the diff command)
print "file3 and file4 had the difference"
endif
답변1
1
차이가 있으면 diff 명령이 종료됩니다 . 쉬운 방법은 이를 성공/실패 확인으로 사용합니다.
diff file1 file2 || print "file1 and file2 had the difference"
diff file3 file4 || print "file3 and file4 had the difference"