In the following command for example, tar -xzv
works but tar -xzvf
fails:
wget ${target_url} -O - | tar -xzv --strip-components 1 -C ${web_application_root}/${domain}
I understand I download a data stream to STDOUT with wget
and pipe it as STDIN to tar
to create an (overriden) directory file with that data.
I know tar -xzvf
fails because a data stream which wasn't stored to a file, isn't a file for the shell; so telling tar -f
"I work with a file" destroys the operation.
I had a case of not noticing -f
and a case I forgot I should remove it when I pipe; these cases happened likely because I almost always do use -f
with tar
.
Is there a version of tar, or a tweak to make tar, ignoring -f
in case data stream wasn't stored to a file?
Related:
1. What is the rationale for using -f in tar
2. tar without -f option in extraction
3. Piping of stream from wget to tar, and extracting it to a specific location failed
tar
that behaves this way.-f
requires an option-argument, this is simple and clear. "Errors" because of my mistakes don't really annoy me. Actual unexpected behavior because some tool tried to be "smart", applied its "fuzzy logic" and backfired – this would be annoying. – Kamil Maciorowski Aug 20 '19 at 12:08