0

While trying to restore the file "derp" the terminal prints derp0000644000175000017500000000000512343302711011660 0ustar UserUserDerp and does not unpack the files , i am confused can someone help me ?

# let the user choose what they want to Restore
echo -n "Select the file or directory you want to Restore" 
read chosendata 

echo -e "Starting Restore"

# unziping files
gunzip -c ${chosendata}
 # end the backup.
echo -e "Restore complete"

1 Answers1

0

"gunzip -c" unzips to stdout rather than to a file. Use "man gunzip" to review options for gunzip.

mc110
  • 2,825
  • 5
  • 20
  • 21
  • ok i removed the -c and now i just have a . tar file not a .tar.gz how do i redirect the file that i get from the new code to tar xvf filename.tar – user3676186 Jun 03 '14 at 09:55
  • If the original file is tarred and then gzipped, normally you'd do tar xzvf to unzip and untar it in one step. Alternatively you can use "gunzip -c" to unzip to stdout, then pipe that to tar to untar, then do whatever you want with the resulting output. – mc110 Jun 03 '14 at 10:05