Is there a way to source a base64 encoded file in bash instead of doing this?

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

If and only if you're supremely confident that the base64-encoded blob is safe:

$ cat test.b64
$ base64 -D test.b64
echo "this is a test"
$ . <(base64 -D test.b64)
this is a test
  • . <(base64 -d test.b64) works. One difference: my base64 works with lowercase 'd' instead of uppercase 'D' – user6679493 Jan 17 at 16:46
  • -D vs. -d is probably a distinction drawn between different versions of the utility. – DopeGhoti Jan 17 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.