
我需要使用以下命令動態解密該檔案來取得該檔案的來源。
. <(gpg -qd "$encrypted_filename")
sh 不支援進程替換。我無法使用 bash。請建議其他方式。
答案1
在一個第二會議:
mkfifo p &&
gpg -d -o p "$encrypted_filename"
# File `p' exists. Overwrite? (y/N) y
在你的原來的會議:
. p
rm p
要在一個會話中完成它,並且如果您對 gpg 感到滿意Assuming "yes" on most questions
,那麼:
mkfifo p &&
gpg --yes -d -o p file.gpg &
. p &&
rm p
帽子提示輸出的評論讓我想起gpg 的--yes
旗幟。
答案2
INSTRUCTIONS="$(gpg -qd $encrypted_filename)"
eval $INSTRUCTIONS