patch
English [p?t?] US [p?t?]
n. ??, ??; ?? ??
vt. ??, ????? ??; .); ?? ?? ??(??) ??
vi. patch
3?? ??: ?? ??: ?? ?? ??: ?? ?? ??: ??: ??
??? ?? ?? ???
??: patch ??? ??? ???? ? ?????. ?? Linux ???? ?? ????? ?? ? ?????.
??: ??patch [-bceEflnNRstTuvZ][-B <?? ??? ???>][-d <?? ????>][-D <?? ??>][-F <? ? ????>] [-g ? ?>][-i ? ??>][-o ? ??>][-p ??? ??>][-r ? ??>][-V <; ?? ??>][-Y ? ??? ???>][-z ? ??? ???>][--backup-if -mismatch ][--binary][--help][--nobackup-if- ???][--verbose][?? ??<?? ??>] ?? ?? [-p <??? ???>] < [ ?? ??]
??? ?? ?? ?
?? ??? ???? "testfile1" ??? ????????. ????? ?? ??? "testfile.patch"???. ?? ??? ?????.
$ patch -p0 testfile1 testfile.patch #使用補丁程序升級文件
? ??? ???? ?? "cat" ??? ???? ??? ? ? ????. "?????1". ?? ? ?????? ??? ??? ?? ?? ??? ???
令"diff"比較可以生成補丁文件。具體操作如下所示: $ cat testfile1 #查看testfile1的內容 Hello,This is the firstfile! $ cat testfile2 #查看testfile2的內容 Hello,Thisisthesecondfile! $ diff testfile1 testfile2 #比較兩個文件 1c1 <Hello,Thisisthefirstfile! --- >Hello,Thisisthesecondfile! #將比較結果保存到tetsfile.patch文件 $ diff testfile1 testfile2>testfile.patch $ cat testfile.patch #查看補丁包的內容 1c1 <Hello,Thisisthefirstfile! --- >Hello,Thisisthesecondfile! #使用補丁包升級testfile1文件 $ patch -p0 testfile1 testfile.patch patching file testfile1 $cat testfile1 #再次查看testfile1的內容 #testfile1文件被修改為與testfile2一樣的內容 Hello,This is the secondfile!? ?????.