I'm trying to download a tar (works) and immediately unpack it to a subdirectory (ideally named the same as the archive). I thought following code should work but it attempts to write the write unpacked files to STDOUT and fails.
wget -O - https://ufal.mff.cuni.cz/~zabokrtsky/courses/npfl104/data/classification/artificial_objects.tgz | tar -xvz --one-top-level
Results in (very cryptic failure):
...
Saving to: ‘STDOUT’
...
Cannot write to ‘-’ (Success).
Not specifying --one-top-level
fixes the issue but then the files inside just get extracted to current folder, as expected.
Doing it in two separate commands: downloading it first and then unpacking with intermediate file works, again as expected.
wget https://ufal.mff.cuni.cz/~zabokrtsky/courses/npfl104/data/classification/artificial_objects.tgz
tar -xvz --one-top-level -f artificial_objects.tgz
I know that I could create a subfolder and change tar's output directory using -C but I'd rather understand why my approach doesn't work.
TAR v2016