我使用hdiutil挂载一个散列映像文件,当我将命令输入终端时,它工作得很好,但是当我试图将它作为shell脚本运行时,它会出现一个错误。
以下是代码:
echo -n 'password' | hdiutil attach -stdinpass file.sparseimage这是一个错误:
hdiutil: attach failed - Authentication error我确信密码是正确的。有人能告诉我是怎么回事吗?
发布于 2013-09-29 23:52:14
hdiutil文档的示例部分建议对此使用printf而不是echo -n。
Creating an encrypted single-partition image without user interaction:
printf pp|hdiutil create -encryption -stdinpass -size 9m sp.dmg如果您正在使用10.9Betas进行测试,请确保同时使用最新版本和10.8版本进行测试。我之所以提到这一点,只是因为我遇到了一些早期版本10.9的与STDIN相关的bug。
https://stackoverflow.com/questions/19084579
复制相似问题