如何在 bash 中取得 Base 64 編碼檔?

如何在 bash 中取得 Base 64 編碼檔?

有沒有辦法在 bash 中取得 Base64 編碼檔案而不是這樣做?

cat $DIR/data/saves/$savegame | base64 --decode > $DIR/data/saves/$savegame.decoded
. $DIR/data/saves/$savegame.decoded
rm $DIR/data/saves/$savegame.decoded > /dev/null

答案1

當且僅當您非常有信心 Base64 編碼的 blob 是安全的:

$ cat test.b64
ZWNobyAidGhpcyBpcyBhIHRlc3QiCg==
$ base64 -D test.b64
echo "this is a test"
$ . <(base64 -D test.b64)
this is a test

相關內容