元ファイルを"hoge.txt.orig", 変更されたファイルを"hoge.txt"とすると
diff -c hoge.txt.orig hoge.txt
として取る. 実際はこの結果を残すためにファイルにリダイレクトする.
差分のファイルを"hoge.diff"とすると以下のようにする.
diff -c hoge.txt.orig hoge.txt > hoge.diff
cオプションは変更部分の前後関係も記録するオプションでこれによって後で正確にパッチを当てることができる.
さらにディレクトリ同士の差分を取るときは
diff -crN 元ディレクトリ 更新済ディレクトリ > 差分ファイル
とする.
ファイルの差分については
patch < 差分ファイル
ディレクトリの差分に対しては
patch -p0 < 差分ファイル
とする.
*** conf/httpd-std.conf Sat Nov 15 16:04:39 2003
--- conf/httpd.conf Mon Nov 17 11:44:16 2003
***************
*** 273,279 ****
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
! ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
--- 273,279 ----
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
! ServerAdmin g031z034@edu.soft.iwate-pu.ac.jp
#
# ServerName gives the name and port that the server uses to identify itself.
***************
*** 287,293 ****
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
! #ServerName www.example.com:80
#
# UseCanonicalName: Determines how Apache constructs self-referencing
--- 287,293 ----
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
! ServerName alpha.foobar.baz:80
#
# UseCanonicalName: Determines how Apache constructs self-referencing
以下のようにしました.
# cd /usr/local/apache2
# umask 022
# mv htdocs htdocs.orig
# mkdir htdocs
# cd htdocs
# vi index.html (中身を作成)
#
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
<title>自己紹介</title>
<style type="text/css"><!--
body{
background-color: white;
color: #3366ff;
}
h1{
background-color: #3366ff;
color: white;
padding: 3px;
}
--></style>
</head>
<body>
<h1>実習のトップページです</h1>
<h2>自己紹介</h2>
<dl>
<dt>名前</td>
<dd>小田桐 京</dd>
<dt>誕生日</td>
<dd>昭和57年4月5日</dd>
<dt>メールアドレス</td>
<dd><a href="mailto:g031z034@edu.soft.iwate-pu.ac.jp">g031z034@edu.soft.iwate-pu.ac.jp</a></dd>
<dt>趣味</td>
<dd>読書</dd>
<dt>好きな食べ物</td>
<dd>ケーキ, パフェ, ギョーザ</dd>
<dt>好きな映画</td>
<dd>THE ROCK</dd>
<dl>
</body>
</html>
CGIダウンロードのの「シンプルBBS」を使いました.
手順は以下のとおり
# cd /usr/local/apache2/cgi-bin
# wget http://www.cgi-down.com/script/simbbs.lzh
(...省略...)
15:11:02 (28.09 KB/s) - `simbbs.lzh' saved [14496/14496]
# umask 022
# lha x simbbs.lzh
simbbs/home_1.gif - Melted : o
simbbs/jcode.pl - Melted : ooo
simbbs/mail_1.gif - Melted : o
simbbs/simbbs.cgi - Melted : ooo
simbbs/simbbs.dat - Melted :
simbbs/style.css - Melted : o
# cd simbbs
# chmod 755 simbbs.cgi
# chmod 666 simbbs.dat
# vi simbbs.cgi (設定を変更)
# cd ..
# cd ..
# cd htdocs
# vi index.html (編集してBBSへのリンクを追加)
#
*** simbbs.cgi.orig Mon Feb 25 23:21:46 2002
--- simbbs.cgi Mon Nov 17 15:16:22 2003
***************
*** 34,43 ****
# 管理者の設定(管理者とは、あなたです)※必須
# -------------------------------------------------------
! $master_name = 'user name'; # 管理者の名前
! $master_email = 'user@***.ne.jp'; # 管理人のメールアドレス
! $master_pass = '123'; # 管理人のパスワード
! $master_url = 'http://www.cgi-down.com/'; # 管理者のURL(トップページ)
# -------------------------------------------------------
# ファイル関連設定 ※必須
--- 34,43 ----
# 管理者の設定(管理者とは、あなたです)※必須
# -------------------------------------------------------
! $master_name = 'Kei.Odagiri'; # 管理者の名前
! $master_email = 'g031z034@edu.soft.iwate-pu.ac.jp'; # 管理人のメールアドレス
! $master_pass = 'potato123'; # 管理人のパスワード
! $master_url = 'http://alpha.foobar.baz/'; # 管理者のURL(トップページ)
# -------------------------------------------------------
# ファイル関連設定 ※必須
*** index.html.orig Mon Nov 17 15:27:29 2003
--- index.html Mon Nov 17 15:27:38 2003
***************
*** 32,38 ****
<dt>好きな映画</td>
<dd>THE ROCK</dd>
<dl>
- <h2>課題の掲示板</h2>
- <p><a href="cgi-bin/simbbs/simbbs.cgi">こちら</a>です.</p>
</body>
</html>
--- 32,36 ----
実際にはこちらをご覧下さい.