gpt4 book ai didi

bash - stdin 到 zip 命令而不是提示符

转载 作者:行者123 更新时间:2023-11-29 09:44:07 25 4
gpt4 key购买 nike

想用密码保护我的 ZIP 存档。

用这个创建存档:

zip -er archivename.zip file

得到这个:

Enter password: 
Verify password:

一切正常,但我有密码变量,需要将此密码发送到 zip。尝试过这样的论点,但失败了。

echo "$1"| zip -er archivename.zip file

在 bash 中可以吗?因为 zip 实用程序不支持 stdin

最佳答案

读人

对于不安全的解决方案,使用-P:

-P|--password password Use password to encrypt zipfile entries (if any). THIS IS INSECURE!

用户互动

-e|--encrypt Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt

关于bash - stdin 到 zip 命令而不是提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20496331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com