文書の過去の版を表示しています。
diff と patch の使い方...🤔
diff の使い方
色付きの出力 diff [--color=auto]
$ diff -u0 --label build.sh --label build.sh --color=auto build.sh.org build.sh
--- build.sh
+++ build.sh
@@ -1 +1 @@
-#!/bin/sh
+#!/bin/sh -x
@@ -161,2 +161,2 @@
- yum update -y
- yum install -y epel-release
+ sudo yum update -y
+
@@ -164 +164,3 @@
- if echo $output | grep " 7."; then
+ if echo $output | grep "Fedora"; then
+ OSTYPE=FEDORA
+ elif echo $output | grep " 7."; then
@@ -171,0 +174,4 @@
+ if [ ! "${OSTYPE}" = "FEDORA" ] ; then
+ sudo yum install -y epel-release
+ fi
+
@@ -187,3 +193,3 @@
- elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
- dnf -y groupinstall "Development Tools"
-
+ #elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
+ elif [ "${OSTYPE}" = "FEDORA" ] || ["${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
+ sudo dnf -y groupinstall "Development Tools"
@@ -195 +201 @@
- yum -y install git cmake
+ sudo yum -y install git cmake
@@ -198 +204 @@
- yum -y install libtool autoconf autoheader automake wget go clang patch expat-devel
+ sudo yum -y install libtool autoconf automake wget golang clang patch expat-devel
@@ -506 +512,2 @@
- git clone https://github.com/litespeedtech/third-party.git
+ git clone --depth 1 https://github.com/litespeedtech/third-party.git
+ patch -p0 < third-party-scripts.patch
※diff の色付き出力は diffutils-3.4 以降の新機能である🤤
$ rpm -qa | grep diffutils
diffutils-3.8-2.fc36.x86_64
GNU diff utilities - News: diffutils-3.4 released [stable] [Savannah]
NEWS * Noteworthy changes in release 3.4 (2016-08-08) [stable] ** New features diff accepts two new options --color and --palette to generate and configure colored output. --color takes an optional argument specifying when to colorize a line: --color=always, --color=auto, --color=never. --palette is used to configure which colors are used.
ニュース👀 * リリース 3.4 (2016-08-08) [安定版] の注目すべき変更点 ** 新機能😻 diff は、2 つの新しいオプション --color と --palette を受け入れて、色付きの出力を 生成および構成します😃 --color は、線をいつ色付けするかを指定するオプションの引数を 取ります: --color=always、--color=auto、--color=never🤤 --palette を使用して、使用 する色を構成します🤔
参考文献
2.6. ソフトウェアへのパッチの適用 Red Hat Enterprise Linux 8 | Red Hat Customer Portal
【 patch 】コマンド――テキストファイルに差分を適用する(応用編):Linux基本コマンドTips(108) - @IT
Linuxエンジニアらしいパッチのつくりかた - Qiita
git diffの全オプション一覧 - Qiita
git diff で作ったパッチはどうやって当てるのか(そもそも git でパッチ | 株式会社ビヨンド
diff & patch コマンドでのパッチを適用する方法 - hogehoge foobar Blog Style Beta
Man page of PATCH
Ubuntu Manpage: diff - 2 つのファイル間の違いを探す
【 diff 】コマンド(基本編)――テキストファイルの差分を出力する:Linux基本コマンドTips(102) - @IT
【 diff 】コマンド(基本編その2)――テキストファイルの差分をcontext形式などで出力する
人生を豊かにする文字列diff入門 | フューチャー技術ブログ
diff
bash - How to color diff output? - Unix & Linux Stack Exchange
diff, match, patch
google/diff-match-patch: Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.
diff-match-patch-python/diff-match-patch: Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.
google-diff-match-patchを使ってかんたんに文章比較(Diff)してみる - Qiita