4
我是Unix和ksh脚本编写的新手。我写了一个解密gpg消息的脚本。我得到这个错误,我不知道如何解决。我希望有人能看我的剧本,并帮助我弄清楚发生了什么。感谢您提供任何帮助。 以下是错误:gpg:处理消息失败:eof;错误Unix ksh GPG解密脚本
gpg: processing message failed: eof
这里是我的脚本:
#!/bin/ksh
####################################################################
# 1. Decrypt Inbound File #
# #
# Two parms are required: output file #
# encrypted file(to be decrypted) #
# #
####################################################################
# Variable declaration #
####################################################################
outputF=$1
encryptedF=$2
id=$$
####################################################################
# print_message #
# prints messages to log file #
####################################################################
print_message()
{
message="$1"
echo "`date '+%m-%d-%y %T'` $message"
}
#####################################################################
# Validate input parameters and existence of encrypted file #
#####################################################################
if [ $1 -eq ""] || [ $2 -eq ""]
then
print_message "Parameters not satisfied"
exit 1
fi
if [ ! -f $encryptedF ]
then
print_message "$id ERROR: $encryptedF File does not exist"
exit 1
fi
#####################################################
# Decrypt encryptedF #
#####################################################
gpg --output "$outputF" --decrypt "$encryptedF"
echo "PASSPHRASE" | gpg --passphrase-fd 0
print_message "$id INFO: File Decrypted Successfully"
您写道:'我得到这个错误,我不知道该怎么resolve' ...请编辑您的消息包含错误消息的确切文本。正如你发现的那样,使用编辑工具来保存消息的格式。祝你好运。 – shellter
@shellter更新了,你认为你可以帮忙吗? – tacotuesday
请编辑你的问题,以显示你正在执行'gpg'哪一行。所有其他代码看起来都不错,我会删除它,只发布'gpg'最简单的测试用例。 .....我不知道我怎么可以帮助,鉴于我所了解的关于unix进程的一般情况,我会希望你的2个命令被合并为一个,并且'gpg'的输出被发送到某个地方:像gpg ...> unecryptedFile这样的重定向文件,或者分配给像myUnecryptedOutput = $(gpg ....)这样的shell变量。你能否更新以包括使用一些简单的输入短语的预期输出?祝你好运。 – shellter