I am trying to configure the AWS CLI using a bash script. I have the below in my script and it will not set the values. When I echo out the variables names it just shows a blank line.
script code
export AWS_ACCESS_KEY_ID=<key>
export AWS_SECRET_ACCESS_KEY=<secret_key>
export AWS_DEFAULT_REGION=<region>
source script.sh
or. script.sh
instead ofscript.sh
– Rui F Ribeiro Aug 15 '18 at 13:19sh -c 'export ID=foo; echo "$ID"'
should work with whateversh
you have, so there's not enough information here to tell what the issue is. – ilkkachu Aug 15 '18 at 13:21./script.sh
- new shell process will be spawned, and when script terminates all is gone - variables will not persist in your current shell environment. If you execute viasource script.sh
, the script will run in a current shell process, thus all the environment changes will remain after script stops it's execution. – Andrejs Cainikovs Aug 15 '18 at 13:21