Find the answer to your Linux question:
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. ...
  1. #1
    Linux Newbie rituraj.goswami's Avatar
    Join Date
    Aug 2008
    Location
    Guwahati
    Posts
    133

    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.

  2. #2
    Linux 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.

    Code:
    tar -tf /path/to/tarfile > /dev/null
    if [ $? -ne 0 ]; then echo "Problem"; fi
    For gzip files I would use gunzip to uncompress the file again redirecting the output to /dev/null.

    Code:
    gunzip < /path/to/gzipfile > /dev/null
    if [ $? -ne 0 ]; then echo "Problem"; fi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...