tar blocksize message
I'm writing a program which untars a file. While doing untar
tar command give message
$ tar -xf testing_Download.txt1.tar
Tar: blocksize = 12
开发者_如何学C
I tried below
$ tar 2>&1 1>/dev/null -xf testing_Download.txt1.tar
Tar: blocksize = 12
Below was command output for tar file which was not present in disk
tar 2>&1 1>/dev/null -xf testing_Download.txt12.tar
tar: cannot open testing_Download.txt12.tar
I want to know how can I tweak my tar command so that I can identify that untar
got executed successfully.
Use the return value of tar.
tar -xf testing_Download.txt1.tar &>/dev/null
if [ "$?" = "0" ];
then
echo "success..."
fi
or check if the file is there first:
if [ -e testing_Download.txt1.tar ];
then
tar -xf testing_Download.txt1.tar &>/dev/null
else
echo "tar file not there"
fi
精彩评论