LoginSignup
16
6

More than 5 years have passed since last update.

バックアップファイルに適当な拡張子をつける時、 .bk ではなく.bak にした方が良いと思う理由

Posted at

メモです。

/etc/sysconfig/network-scripts/ifcfg-*

をいじった時にバックアップとして .bk にしたら無視されずに読み込まれたから。
同じディレクトリに保存しなければいいだけなんですけどね。

/etc/init.d/network に

# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
interfaces=$(ls ifcfg-* | \
      LC_ALL=C sed -e "$__sed_discard_ignored_files" \
           -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
           -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \
      LC_ALL=C sort -k 1,1 -k 2n | \
      LC_ALL=C sed 's/ //')
rc=0

ってあって、 $__sed_discard_ignored_files

/etc/init.d/functions に定義されていて、

# A sed expression to filter out the files that is_ignored_file recognizes
__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'

このパターンのときは無視するようになってます。
同じような理由で、オリジナルを意味する拡張子も .orgではなく .orig が好みです。

man patch

捗れ〜。

16
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
6