I want to test 10 passwords against a zip file. If i type:

unzip file.zip

the output is:

Archive:  file.zip
[file.txt] file.txt password:

I want to create a bash script that test 10 passwords. How can I input these 10 passwords to this line:

[file.txt] file.txt password:

using bash script?

  • 1
    unzip -P password1 file.zip?
    – jsbillings
    Apr 26, 2020 at 2:46
  • no the bash script stops if the password is wrong. It wont go to try next line.
    – Rembo
    Apr 26, 2020 at 3:13

1 Answer 1


Put your 10 guesses in a file called password.list.
Then iterate through that file and try each guess one at a time. Like so:

for i in $(cat password.list)
  unzip -P "$i" file.zip && exit 0 || echo "sorry, did not find password"

This will exit upon guessing correctly but otherwise it will continue to the end of file.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .