How to Export a Multi-line Environment Variable in Bash/Terminal e.g: RSA Private Key

后端 未结 6 1778
半阙折子戏
半阙折子戏 2020-12-13 09:01

One of our Apps github-backup requires the use of an RSA Private Key as an Environment Variable.

Simply attempting to export the key it in the terminal e.g: te

6条回答
  •  遥遥无期
    2020-12-13 09:28

    NOTE: For me to get the output to work correctly, I had to wrap the environment variable in double quotes. Otherwise it replaced newlines with spaces.

    In:

    export PRIVATE_KEY=$(cat ./gitbu.2018-03-23.private-key.pem)
    

    Out:

    echo "$PRIVATE_KEY"
    

提交回复
热议问题