I have multiple Amazon EC2 accounts and want to quickly be able to switch variables, such as $EC2_HOME
, using a script.
I have have a shell script set up like this:
#!/bin/sh
export EC2_HOME=/home/me/.ec2
echo $EC2_HOME
When I run the script I know that EC2_HOME
is set, but I thought that using export
would make the variable stick around after the script completed. It does not, as running echo $EC_HOME
does not show anything.
I know this must be very rudimentary Linux scripting knowledge, but I don't know it. I tried looking for related questions without luck – so my apologies if this is a duplicate.
Best Answer
You should source your script, with
or