Print ENV VAR name to file, not value, from Linux CLI

Create a script to add an API text hook with the MY_ENV_VAR key to a file:

#!/bin/bash 
... 
echo $MY_ENV_VAR

Problem: The MY_ENV_VAR is not set when this file is made, resulting in an empty string being printed in the file.

Solution: Search the internet for solutions on how to print the key of the environment variable to the file. Various syntaxes such as (), "", and {} have been tried.

The solution to print the value of the MY_ENV_VAR environment variable to the file is to enclose the variable in double quotes and use the $ symbol to access its value. Modify the script as shown below:

#!/bin/bash 
... 
echo "$MY_ENV_VAR"

This will ensure that the value of the MY_ENV_VAR environment variable is printed to the file, even if it is not set, without resulting in an empty string.