tar: file changed as we read it

前端 未结 8 1980
你的背包
你的背包 2020-12-02 15:03

I am using make and tar to backup. When executing makefile, tar command shows file changed as we read it. In this case,

8条回答
  •  死守一世寂寞
    2020-12-02 15:54

    Here is a one-liner for ignoring the tar exit status if it is 1. There is no need to set +e as in sandeep's script. If the tar exit status is 0 or 1, this one-liner will return with exit status 0. Otherwise it will return with exit status 1. This is different from sandeep's script where the original exit status value is preserved if it is different from 1.

    tar -czf sample.tar.gz dir1 dir2 || [[ $? -eq 1 ]]

提交回复
热议问题