I have a double-compressed file (.tar.gz
inside a .tar
) and i would like to know if there is any way to automatically extract it from a bash script. I tried two approaches:
tar -xf $1 #the first .tar file is passed as argument to the bash script
tar -xf /home/user/working_dir/file_inside.tar.gz #passing the absolute path to the file assuming the .tar file was extracted as expected.
tar -xf $1 | tar -xf `xargs`
But i get the error: tar: /file_inside.tar.gz: Cannot open: No such file or directory
.
Thanks in advance.