I've been doing a lot of work within the AWS Command Line and it's been forcing me to make the best use of environment and shell variables. Below are really simple examples of how to store both types.
Environmental variables are system variables that cannot be changed by any user. Although they are dynamic in nature, they do not change much.
View a list of your environment variables.
View the details of a specific environmental variable.
Shell variables are also known as user variables. They do vary based on the user and their permissions. Think of these as temporary variables that will disappear once you close your terminal window.
List all shell variables.
Create a shell variable.
View the details of a specific shell variable.
Find your shell variable with only partial information.
set | grep MY
Note: Once you close your terminal account, they may dissapear.
Advanced Variable Assignment
You can assign more complicated strings to shell variables but they require a bit more work. Since we're only using Terminal right now, here's how to create a JSON file using cat. cat will allow you to create a multiline text file and export it.