【发布时间】:2013-08-05 21:50:37
【问题描述】:
我是 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"
【问题讨论】:
-
您写道:
I get this error that I do not know how to resolve... 请编辑您的消息以包含错误消息的确切文本。正如您所发现的,使用{}编辑工具来保持消息的格式。祝你好运。 -
@shellter 更新了,你觉得你能帮忙吗?
-
请编辑您的问题以显示您正在执行的
gpg行。所有其他代码看起来都很好,我会删除它,并且只发布gpg的最简单的测试用例。 .....我不确定如何提供帮助,鉴于我对unix进程的一般了解,我希望您的2个命令合并为一个,并将gpg的输出发送到某处:像gpg ... > unecryptedFile这样的重定向文件或分配给像myUnecryptedOutput=$(gpg .... )这样的shell 变量。您可以更新以包含使用一些简单输入短语的预期输出吗?祝你好运。