I have a zipped file like
myArchive123.tar.gz. Inside, it contains a folder like
If I extract it with
tar -xf myArchive123.tar.gz, I get the
ls myArchive123.tar.gz helloWorld
I want the output to be the same as the file name minus the
.tar.gz extension. I.e.:
tar <magic paramaters> myArchive123.tar.gz ls myArchive123.tar.gz myArchive123 cd myArchive123 ls helloWorld
Can this be done?
- I never know what's inside the archive. It could be a folder, could be many files.
- I'd be ok with using another tool if tar can't do it.
- I'd be ok with a longer form that can be turned into a script
In the meantime, I wrote myself a script that seems to get the job done (see my posted answer below). The main thing is that it should be packageable into a one-liner like: