differ=$(diff -rq $1 $2| awk {'print $2,$3,$4'} );for file in $differ
do
echo $file
done
$file 输出如下
/home/test/system/app.text
and
/home/vgg/system/app.text
/home/test/system/app1.text
and
/home/vgg/system/app2.text
in
/home/test/system:
app.txt
我想让其
vimdiff 旧文件 新文件
确认无误后
cp /home/test/system/app.txt /home/vgg/system/app.txt
如果是只是单独的某个文件有的话 in ...
cp /home/test/system/app.txt /home/vgg/system/app.txt
2 回答
qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
# ---------------------------------------- Function ---------------------------------------- #
function checkFilesDiff()
{
# diff -c -a -b -r -q -P $1 $2
homeq=($(diff -rq $1 $2 | grep -Ff $3 | grep -Fvf $noGrep|awk {'print $2'} ));
mydir=($(diff -rq $1 $2 | grep -Ff $3 | grep -Fvf $noGrep|awk {'print $4'} ));
i=0
while [[ i -lt ${#homeq[@]} ]]; do
vimdiff ${mydir[i]} ${homeq[i]}
deploy_confirm " 修改确认 ${mydir[i]} ?"
if [ 1 != $? ]; then
let i++
continue;
fi
sleep 1
cp ${mydir[i]} ${homeq[i]}
let i++
done
}
添加回答
举报
0/150
提交
取消