shell 脚本(通过 cron 运行)在出现提示时输入密码

发布于 2024-09-16 05:55:39 字数 120 浏览 6 评论 0原文

我有一个每日 cron 任务,它会自动解压 rar 文件并处理其内容,但是,内容现在受密码保护,所以我想知道是否有可靠的方法在出现提示时回显密码?密码提示来自我安装的 UNRAR 程序,在 CentOS 上运行。感谢您的帮助!

I have a daily cron task which automatically unrars a rar file and processes it's contents, however, the contents are now password protected so i'm wondering if there's a reliable way to echo the password when prompted? The password prompt comes from the UNRAR program i've installed, running on CentOS. Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2024-09-23 05:55:39

如果您使用 unrar 进行解压,您可以将密码定义为命令行参数:

unrar x -ppassword package.rar

请注意,-p 和您的密码 参数。

If you're using unrar for unpacking, you can define the password as command line parameter:

unrar x -ppassword package.rar

Note that there's no space between -p and your password parameter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文