Site icon Leonid Mamchenkov

How can I patch a script on a Linux system?

“linux how to patch sample script”

Well, patching is simple. Consider the following scenario: we have a script file named script.pl to which we need to make changes, save them in the patch. We start by copying the original file to the working file with the command cp script.pl script-my.pl . Then we do whatever changes we want in file script-my.pl . Then we run a command diff -u script.pl script-my.pl > script-my.diff . At this time, file script-my.diff contains the changes that we made to the original script.pl . In case we want to distribute our changes to someone else, we just send them the script-my.diff file and those people need to run a single command like patch to have a copy of the script.pl file identical to our script-my.pl . More information can be obtained from reading the Linux manual pages for diff and patch with commands man diff and man patch on any Linux system.

Exit mobile version