LoginSignup
2
2

More than 5 years have passed since last update.

まるっとファイルをコピーしつつ、特定のファイルだけ除外する、みたいな処理。

Posted at

wc -l で該当テキストの行数が出るので、それで判別すると確実。

#!/bin/sh

file="js/app/hoge.config.js"
dev="./dev/$file"
pre="./pre/$file"

if [ -e $pre ]; then
    mv $pre $pre.back
fi

cp -r ./dev/* ./pre

if [ -e $pre.back ]; then
    if [ -e $pre ]; then
        rm $pre
    fi

    mv $pre.back $pre
fi

if [ $(diff $pre $dev | wc -l) -ne 0 ]; then
    echo 'Maybe the file was modified.'
fi

2
2
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
2
2