我有以下脚本:
#!/bin/sh -e
PWD="supersecretpassword"
file="/backup/2do/example.txt"
echo before
echo $PWD | gpg --passphrase-fd 0 -c $file
echo after
如果手动执行,脚本可以正常工作,但是当执行gpg行作为crontab执行时,它会停止工作.
GPG显示:
gpg: cannot open `/dev/tty': No such device or address
我很感激任何建议!
解:
将–no-tty添加到GPG