Shell zip with unattended password

I have a script that runs some automatic zip generation using shell zip. The request is to add automatic encryption with password. From what I understand, the option -e is the right one, but it asks for the password by prompt; instead I need to make this step automatically, giving the password as an option or as a file.

In other words, if I write:

zip -e

Then a prompt asking the password two times is presented. Instead I want to do something like:

zip -e:thisisapassword

and have a zip file protected with password: thisisapassword

Does anyone any hints how to accomplish this?


Solution 1:

Most forms of zip encryption do not support encryption with a command line password. Here is one form based on Igor Pavlov's 7-zip called jZip that might work -- have not tried it myself.

Option: -s[password]