How do you specify filenames within a zip when creating it on the command line from a pipe?

后端 未结 6 1858
面向向阳花
面向向阳花 2020-12-13 19:46

I\'m trying to create a zip file from file contents which are being piped in, e.g.

mysql [params and query] | zip -q output.zip -

This writ

6条回答
  •  孤街浪徒
    2020-12-13 19:53

    You can use a named pipe, and send the request output to it, while zipping from it.

    mkfifo output.txt ; mysql [params and query] > output.txt & zip output.zip -FI output.txt ; rm output.txt
    

提交回复
热议问题