Reputation: 29
I cannot seem to get my bash script to work, i want to pipe the output from the gunzip command to another command but it is not working, can anyone help me?
The gunzip command outputs a tar file that i want to then use the tar command to put back yo the original file.
# 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 ${Chosendata} | tar xvf - #Here
# end the restore.
echo -e "Restore complete"
Upvotes: 1
Views: 225
Reputation: 8972
Use gunzip -c
.
-c, --stdout write on standard output, keep original files unchanged
Or tar only: tar -xzf ${Chosendata}
.
Upvotes: 4