views:

290

answers:

2

Is it possible to use something like:

command.exe | zip >> archive.zip

command2.exe | zip >> archive.zip

...and end up with two named files inside one zip archive. This way, if at all possible, would be neater than having temp files.

A: 

Use fuse, fuze-zip rather.

RandomNickName42
A: 

Create two named pipes in a new dir (with mkfifo), pipe the output of the commands to these two pipes and then zip the dir.

mkdir tmp
mkfifo tmp/1.out
mkfifo tmp/2.out
command1.exe > tmp/1.out
command2.exe > tmp/2.out
zip -FI -r tmp.zip tmp/

EDIT: Added the FI flag to zip, which does make this possible. The only caveat is that you need zip 3.0 for this to work. Tar:ing FIFO:s is not implemented (according to tar devs) because you need the file size in advance in order to write it to the TAR header.

disown