我正在尝试制作一个脚本来解压缩受密码保护的文件,密码是我在解压时得到的文件名
例如。
file1.zip contains file2.zip and it's password is file2.
file2.zip contains file3.zip and it's password is file3
Run Code Online (Sandbox Code Playgroud)
我如何解压缩file1.zip,并读取它的名称file2.zip以便它可以输入到脚本中?
这是我的意思的屏幕截图,我只需要 bash 读取该输出即可知道新密码(在这种情况下,密码是 13811)。
这是我到目前为止所做的
#!/bin/bash
echo First zip name:
read firstfile
pw=$(zipinfo -1 $firstfile | cut -d. -f1)
nextfile=$(zipinfo -1 $firstfile)
unzip -P $pw $firstfile
rm $firstfile
nextfile=$firstfile
Run Code Online (Sandbox Code Playgroud)
现在我怎样才能让它做循环?