我似乎不能让我的bash脚本工作,我想管道输出从gunzip命令到另一个命令,但它不工作,有人能帮助我吗?
gunzip命令输出一个tar文件,然后我想使用tar命令将其放回原始文件。
# 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"
使用gunzip -c
-c, --stdout write on standard output, keep original files unchanged
或tar only: tar -xzf ${Chosendata}
.