Update: On closer inspection of the man page it appears that it is not yet supported by unzip to read archives from standard input. The man page refers the user to funzip
instead. I guess this makes my question moot, but I will leave it regardless.
I am trying to compose zip and unzip to create a command that acts as the identity function, meaning that it accepts input in stdin and produces the same output on stdout. I am, however, not able to get it working. I read both manual pages (especially zip had a detailed one) and believed that this would work
echo "hello" | zip | unzip -p | echo
Explanation:
- echo should produce the initial standard input
- zip without commands, according to the man page, takes input on stdin and produces output on stdout
- unzip with -p should produce output on stdout. NOTE: I believe something might be missing here, to indicate that input is arriving from stdin. I tried adding
-
but it did not work. The man page does not seem to cover this. - echo to visualize what appeared on stdout
Please note: I am only trying to feed a single file through this command, so I do not need to worry about directories/multiple files.
echo
to visualize what appeared on stdout" – Even ifzip
andunzip
worked as you want,| echo
would be wrong.zip
? Zip is an archiver (which can also compress), and it seems you want a compressor instead:cat | cat
ortac | tac
? Can't get much simpler than the first