old file = composing_commands.sh.1 new file = composing_commands.sh (I added one one to it) so users have old file and I want to provide for them to update. tiias5:shellscripts/>diff composing_commands.sh composing_commands.sh.1 36d35 < if com1 && com2 && com3; then echo "commands 1 and 2"; fi tiias5:shellscripts/>diff -e composing_commands.sh composing_commands.sh.1 36d tiias5:shellscripts/>diff composing_commands.sh.1 composing_commands.sh 35a36 > if com1 && com2 && com3; then echo "commands 1 and 2"; fi tiias5:shellscripts/>diff -c composing_commands.sh.1 composing_commands.sh *** composing_commands.sh.1 Thu Mar 3 16:56:26 2005 --- composing_commands.sh Thu Mar 3 15:37:12 2005 *************** *** 33,35 **** --- 33,36 ---- #using short circuit command we do conditional execution of if block #which we could have wrapped in function and then use above style + if com1 && com2 && com3; then echo "commands 1 and 2"; fi tiias5:shellscripts/>diff -c composing_commands.sh.1 composing_commands.sh > mypatch.txt tiias5:shellscripts/>patch composing_commands.sh.1 mypatch.txt patching file composing_commands.sh.1 tiias5:shellscripts/>diff composing_commands.sh composing_commands.sh.1 tiias5:shellscripts/> diff -e oldfile newfile will output all changes needed to update oldfile to newfile. This output we call patch. To apply this patch first we need to modify the patch. Add w Q to end of patch file. patch output did not have those to commands to persists changes. Without it when patch is applied it will print ? which is ed way for prompting user should you quit with unsaved changes. ex. we have old file composing_commands.sh.1 and new file composing_commands.sh. Here old = composing_commands.sh.1 while new = composing_commands.sh pisdb40:shellscripts/>diff composing_commands.sh.1 composing_commands.sh 36c36,37 < if com1 && com2 && com4; then echo "commands 1 and 2"; fi --- > if com1 && com2 && com3; then echo "commands 1 and 2"; fi > echo "hello world" pisdb40:shellscripts/>diff -e composing_commands.sh.1 composing_commands.sh 36c if com1 && com2 && com3; then echo "commands 1 and 2"; fi echo "hello world" . pisdb40:shellscripts/>sh.1 composing_commands.sh > mypatch.txt < pisdb40:shellscripts/>cat mypatch.txt 36c if com1 && com2 && com3; then echo "commands 1 and 2"; fi echo "hello world" . pisdb40:shellscripts/>ed composing_commands.sh.1 < mypatch.txt 590 ? pisdb40:shellscripts/>vi mypatch.txt pisdb40:shellscripts/>ed composing_commands.sh.1 < mypatch.txt 590 609 pisdb40:shellscripts/>diff composing_commands.sh composing_commands.sh.1 pisdb40:shellscripts/>