我是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"
{}
编辑工具来保持消息的格式。祝你好运。 - shelltergpg
行。所有其他代码看起来都很好,我会删除它,并发布一个简单的gpg
测试用例。... 我不确定如何提供帮助,因为我对Unix进程的了解很有限,我希望您的两个命令被合并为一个,并且gpg
的输出被发送到某个地方:像gpg ...> unecryptedFile
这样的重定向文件,或者分配给shell变量,例如myUnecryptedOutput=$(gpg ....)
。您能否更新以包括使用一些简单输入短语的预期输出? 祝好运。 - shellter