Results 1 to 2 of 2
well, i get a lot of tar and gzip packages from my client and i have to run scripts on them. some times the tar or gzip packages are corrupt. ...
- 02-20-2009 #1
help checking tar packages
well, i get a lot of tar and gzip packages from my client and i have to run scripts on them. some times the tar or gzip packages are corrupt. can anyone tell me how to check the tar or gzip packages for errors.
- 02-20-2009 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Well for tar I would use the -t option to produce a list redirecting the output to /dev/null. Then check return code $?. If it's non-zero then there's a problem.
For gzip files I would use gunzip to uncompress the file again redirecting the output to /dev/null.Code:tar -tf /path/to/tarfile > /dev/null if [ $? -ne 0 ]; then echo "Problem"; fi
Code:gunzip < /path/to/gzipfile > /dev/null if [ $? -ne 0 ]; then echo "Problem"; fi


Reply With Quote